2017 © Pedro Peláez
 

library bitstream-iterator

A class for iterating through a stream of bits

image

dshepherd/bitstream-iterator

A class for iterating through a stream of bits

  • Friday, July 20, 2018
  • by dshepherd
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Bitstream Iterator


Installation

composer require dshepherd/bitstream-iterator

Usage


$bytes = [0xDE, 0xCA, 0xFB, 0xAD, 0xD0]; $iterator = new BitStreamIterator($bytes); $message = dechex(bindec(implode('', $iterator->take(20)))); $message .= ' ' . dechex(bindec(implode('', $iterator->take(12)))); $flag = $iterator->take(1); $options = $iterator->take(3); printf('Message: %s' . PHP_EOL, $message); printf('Flag is %s' . PHP_EOL, $flag ? 'set' : 'not set'); for ($x = 0; $x < 4; $x++) { printf('Bit %d is %s' . PHP_EOL, $x, ($options & pow($x, 2)) != 0 ? 'set' : 'not set'); }

The Versions

20/07 2018

dev-master

9999999-dev https://github.com/dshepherd/bitstream-iterator

A class for iterating through a stream of bits

  Sources   Download

MIT

The Requires

  • php ^7.1

 

by Dan Shepherd

iterator bitstream

20/07 2018

v1.0.0

1.0.0.0 https://github.com/dshepherd/bitstream-iterator

A class for iterating through a stream of bits

  Sources   Download

MIT

The Requires

  • php ^7.1

 

by Dan Shepherd

iterator bitstream