Skip to content

Instantly share code, notes, and snippets.

@mikeemoo
Created October 21, 2014 13:12
Show Gist options
  • Save mikeemoo/de1b172d06bb9d8c8635 to your computer and use it in GitHub Desktop.
Save mikeemoo/de1b172d06bb9d8c8635 to your computer and use it in GitHub Desktop.
<?php
echo "Testing bit stream:\n";
$handle = fopen('80_team-ldlc-fnatic_de_dust2.dem', 'rb');
$byteStream = new phpgo\IO\ByteStream($handle);
$stream = new phpgo\IO\BitStream($byteStream);
// show first int
var_dump($stream->int32());
// read 32 bits
$stream->int32();
// short last int
var_dump($stream->int32());
fclose($handle);
echo "Testing byte stream:\n";
$handle = fopen('80_team-ldlc-fnatic_de_dust2.dem', 'rb');
$stream = new phpgo\IO\ByteStream($handle);
// show first int
var_dump($stream->int32());
// read 32 bits
$stream->getBits(1);
$stream->getBits(1);
$stream->getBits(1);
$stream->getBits(1);
$stream->getBits(4);
$stream->getBits(24);
// show last int
var_dump($stream->int32());
fclose($handle);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment