Page MenuHomeDevCentral

Represent a bits vector
ClosedPublic

Authored by dereckson on Apr 9 2022, 18:27.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 19, 02:10
Unknown Object (File)
Tue, Nov 19, 01:15
Unknown Object (File)
Mon, Nov 18, 08:52
Unknown Object (File)
Mon, Nov 18, 08:35
Unknown Object (File)
Sat, Nov 16, 01:55
Unknown Object (File)
Fri, Nov 15, 23:58
Unknown Object (File)
Tue, Nov 12, 09:49
Unknown Object (File)
Mon, Nov 11, 23:48
Subscribers
None

Details

Summary

\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

Test Plan

Unit tests provided, with full coverage for BaseVector, BitsVector, Vector.

Diff Detail

Repository
rKERUALD Keruald libraries development repository
Lint
Lint Errors
SeverityLocationCodeMessage
Erroromnitools/src/Collections/BaseVector.php:136PHPCS.E.Generic.Files.LineLength.MaxExceededGeneric.Files.LineLength.MaxExceeded
Erroromnitools/src/Collections/BitsVector.php:18PHPCS.E.Generic.Files.LineLength.MaxExceededGeneric.Files.LineLength.MaxExceeded
Erroromnitools/src/Collections/BitsVector.php:77PHPCS.E.Generic.Files.LineLength.MaxExceededGeneric.Files.LineLength.MaxExceeded
Erroromnitools/src/Collections/BitsVector.php:101PHPCS.E.Generic.Files.LineLength.MaxExceededGeneric.Files.LineLength.MaxExceeded
Warningomnitools/src/Collections/BaseVector.php:137PHPCS.W.Generic.Files.LineLength.TooLongGeneric.Files.LineLength.TooLong
Warningomnitools/src/Collections/BaseVector.php:139PHPCS.W.Generic.Files.LineLength.TooLongGeneric.Files.LineLength.TooLong
Warningomnitools/src/Collections/BitsVector.php:34PHPCS.W.Generic.Files.LineLength.TooLongGeneric.Files.LineLength.TooLong
Warningomnitools/src/Collections/BitsVector.php:55PHPCS.W.Generic.Files.LineLength.TooLongGeneric.Files.LineLength.TooLong
Warningomnitools/src/Collections/BitsVector.php:163PHPCS.W.Generic.Files.LineLength.TooLongGeneric.Files.LineLength.TooLong
Warningomnitools/src/Collections/BitsVector.php:165PHPCS.W.Generic.Files.LineLength.TooLongGeneric.Files.LineLength.TooLong
Warningomnitools/src/Collections/BitsVector.php:178PHPCS.W.Generic.Files.LineLength.TooLongGeneric.Files.LineLength.TooLong
Warningomnitools/tests/Collections/BitsVectorTest.php:59PHPCS.W.Generic.Files.LineLength.TooLongGeneric.Files.LineLength.TooLong
Warningomnitools/tests/Collections/BitsVectorTest.php:60PHPCS.W.Generic.Files.LineLength.TooLongGeneric.Files.LineLength.TooLong
Warningomnitools/tests/Collections/BitsVectorTest.php:173PHPCS.W.Generic.Files.LineLength.TooLongGeneric.Files.LineLength.TooLong
Unit
Tests Passed
Branch
bitsvector
Build Status
Buildable 4171
Build 4423: arc lint + arc unit

Event Timeline

dereckson created this revision.
dereckson edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Apr 9 2022, 18:29
This revision was landed with ongoing or failed builds.Apr 9 2022, 18:29
This revision was automatically updated to reflect the committed changes.