aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/BitOps/UnpackFloatSpecifiers.php
blob: 5a3aa4f5e79cd8350b8f085501fdc64117501966 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php

declare(strict_types=1);

namespace Nsfisis\Waddiwasi\BitOps;

enum UnpackFloatSpecifiers: string
{
    case Float32LittleEndian = 'g';
    case Float64LittleEndian = 'e';

    public function byteCount(): int
    {
        return match ($this) {
            self::Float32LittleEndian => 4,
            self::Float64LittleEndian => 8,
        };
    }
}