efficient conversion of 16 bit integer to three 7 bit bytes

Dan Nigrin's icon

I need to convert a 16 bit integer into three, 7 bit bytes; the first byte contains bits 15,14; the second byte bits 13-7; and the 3rd byte bits 6-0. I thought this should be doable in an efficient way using a combination of bitwise operators >> and &, but so far I'm not succeeding. Can someone help?

Dan Nigrin's icon

Answering my own question - see patch below. Many things to Peter Elsea! http://peterelsea.com/Maxtuts_basic/Max&Numbers.pdf

Max Patch
Copy patch and select New From Clipboard in Max.