Log In  

Cart #knutil_bpack-0 | 2022-12-01 | Code ▽ | Embed ▽ | No License

Feature Overview

BPACK() pack the value of the bit specification with bit width.

  • By packs in the direction of low bits when multiple bit values are specified.
  • By setting [number s] to a negative value, bit pack can be started from the decimal point.
  • If there are fewer bit-width elements relative to the value to be packed, the bit-width elements are rotated.
  • This function consumes 37 Token.
v=bpack({8,4},0,0xff,0xb)
?tostr(v,1) -- 0x00ff.b000 (bit-left-shift:0)

v=bpack({8,4},8,0xff,0xb)
?tostr(v,1) -- 0xffb0.0000 (bit-left-shift:8)

This function is included in the KNUTIL library.

release note


v0.1

  • first release
P#59572 2022-12-01 13:18 ( Edited 2022-12-02 15:17)


[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 07:15:57 | 0.009s | Q:14