-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split Types class into several new classes
the main benefit of this is the increased difficulty of accidentally using the wrong byte order due to auto complete - now choosing byte order is decided by the first character typed. however, it also reduces the verbosity of the API, though I'm not sure about the 'LE' and 'BE' class names.
- Loading branch information
Showing
14 changed files
with
182 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#ifndef TYPES_H | ||
#define TYPES_H | ||
|
||
zend_class_entry* init_class_Types(void); | ||
void init_class_Types(void); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
<?php | ||
|
||
use pmmp\encoding\Types; | ||
use pmmp\encoding\BE; | ||
use pmmp\encoding\LE; | ||
|
||
return [ | ||
[Types::readUnsignedShortLE(...), "\xff\xff"], | ||
[Types::readSignedShortLE(...), "\xff\xff"], | ||
[Types::readUnsignedShortBE(...), "\xff\xff"], | ||
[Types::readSignedShortBE(...), "\xff\xff"], | ||
[LE::readUnsignedShort(...), "\xff\xff"], | ||
[LE::readSignedShort(...), "\xff\xff"], | ||
[BE::readUnsignedShort(...), "\xff\xff"], | ||
[BE::readSignedShort(...), "\xff\xff"], | ||
|
||
[Types::readUnsignedIntLE(...), "\xff\xff\xff\xff"], | ||
[Types::readSignedIntLE(...), "\xff\xff\xff\xff"], | ||
[Types::readFloatLE(...), "\x11\xff\xff\x11"], | ||
[Types::readUnsignedIntBE(...), "\xff\xff\xff\xff"], | ||
[Types::readSignedIntBE(...), "\xff\xff\xff\xff"], | ||
[Types::readFloatBE(...), "\x11\xff\xff\x11"], | ||
[LE::readUnsignedInt(...), "\xff\xff\xff\xff"], | ||
[LE::readSignedInt(...), "\xff\xff\xff\xff"], | ||
[LE::readFloat(...), "\x11\xff\xff\x11"], | ||
[BE::readUnsignedInt(...), "\xff\xff\xff\xff"], | ||
[BE::readSignedInt(...), "\xff\xff\xff\xff"], | ||
[BE::readFloat(...), "\x11\xff\xff\x11"], | ||
|
||
[Types::readSignedLongLE(...), "\xff\xff\xff\xff\xff\xff\xff\xff"], | ||
[Types::readSignedLongBE(...), "\xff\xff\xff\xff\xff\xff\xff\xff"], | ||
[Types::readDoubleLE(...), "\x11\xff\xff\x11\x11\xff\xff\x11"], | ||
[Types::readDoubleBE(...), "\x11\xff\xff\x11\x11\xff\xff\x11"], | ||
[LE::readSignedLong(...), "\xff\xff\xff\xff\xff\xff\xff\xff"], | ||
[BE::readSignedLong(...), "\xff\xff\xff\xff\xff\xff\xff\xff"], | ||
[LE::readDouble(...), "\x11\xff\xff\x11\x11\xff\xff\x11"], | ||
[BE::readDouble(...), "\x11\xff\xff\x11\x11\xff\xff\x11"], | ||
|
||
[Types::readUnsignedTriadBE(...), "\xff\xee\xdd"], | ||
[Types::readUnsignedTriadLE(...), "\xdd\xee\xff"], | ||
[Types::readSignedTriadBE(...), "\xff\xee\xdd"], | ||
[Types::readSignedTriadLE(...), "\xdd\xee\xff"], | ||
[BE::readUnsignedTriad(...), "\xff\xee\xdd"], | ||
[LE::readUnsignedTriad(...), "\xdd\xee\xff"], | ||
[BE::readSignedTriad(...), "\xff\xee\xdd"], | ||
[LE::readSignedTriad(...), "\xdd\xee\xff"], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.