問題タブ [bit-packing]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
binary - Pack a number into an odd number of bits
2 header field that is 19 bits long. I'm trying to pack the number 921 decimal into hex into it. Least Significant Byte first.
Packing into 24 bits is easy:
921.0 = 0x0399
binary:
9 9 0 3 0 0
1001 1001 0000 0011 0000 0000
and done. Result: 0x990300
How do I do pack this into 19 bits?
c++ - CUDAでビットを(効率的に)パックする方法は?
各バイトが 0 または 1 のバイト配列があります。これらの値をビットにパックして、元の 8 バイトが 1 つのターゲット バイトを占め、元のバイト 0 がビット 0、バイト 1 がビット 1 になるようにします。など。これまでのところ、カーネルには次のものがあります。
これは正しく効率的ですか?