blob: be210f3450c084d6766f9e1f604ec10c663d6e3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<?php
declare(strict_types=1);
namespace Nsfisis\Waddiwasi\BitOps;
enum UnpackIntSpecifiers: string
{
case SignedInt8 = 'c';
case SignedInt16MachineOrder = 's';
case SignedInt32MachineOrder = 'l';
case UnsignedInt32LittleEndian = 'V';
case SignedInt64MachineOrder = 'q';
public function byteCount(): int
{
return match ($this) {
self::SignedInt8 => 1,
self::SignedInt16MachineOrder => 2,
self::SignedInt32MachineOrder, self::UnsignedInt32LittleEndian => 4,
self::SignedInt64MachineOrder => 8,
};
}
}
|