Home
DevCentral
Search
Configure Global Search
Log In
Transactions
D2659
Change Details
Change Details
Old
New
Diff
Traditionnally, Perl offers a pack() function to encode information into a binary string, and read the string as ASCII. That function has been ported into PHP. Yet, this representation is especially useful when we manipulate bytes, and some data structures like cut bits blocks in other boundaries than bytes. For example UUID use 60 bits timestamp, 2 bits variant and 4 bits version fields. That requires to combine two fields in one byte. As an alternative, \Keruald\OmniTools\Collections\BitsVector allows to represent vector of bits, and manipulate them with expressive oriented-object methods. That allows to clearly express the bits manipulation without any arcane notations like `uuid->time_hi_and_version |= (v << 12)`. Ref T1717
\Keruald\OmniTools\Collections\BitsVector allows to represent vector of bits, and manipulate them with expressive oriented-object methods. That allows to clearly express the bits manipulation without any arcane notation like `uuid->time_hi_and_version |= (v << 12)` in C. **Context** Traditionally, Perl offers a pack() function to encode information into a binary string, and read the string as ASCII. That function has been ported into PHP. Yet, this representation is especially useful when we manipulate bytes, and some data structures like cut bits blocks in other boundaries than bytes. For example UUID use 60 bits timestamp, 2 bits variant and 4 bits version fields. That requires to combine two fields in one byte. Ref. T1717
Tradition
\Keruald\OmniTools\Collections\BitsVector allows to represent vector of bits, and manipulate them with expressive oriented-object methods. That allows to clearly express the bits manipulation without any arcane notation like `uuid->time_hi_and_version |= (v << 12)` in C. **Context** Traditio
nally, Perl offers a pack() function to encode information into a binary string, and read the string as ASCII. That function has been ported into PHP. Yet, this representation is especially useful when we manipulate bytes, and some data structures like cut bits blocks in other boundaries than bytes. For example UUID use 60 bits timestamp, 2 bits variant and 4 bits version fields. That requires to combine two fields in one byte.
As an alternative, \Keruald\OmniTools\Collections\BitsVector allows to represent vector of bits, and manipulate them with expressive oriented-object methods
Ref
.
That allows to clearly express the bits manipulation without any arcane notations like `uuid->time_hi_and_version |= (v << 12)`. Ref
T1717
Continue