allow setting trim bits
add trimbits test (to be tested)