aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/BitOps/UnpackFloatSpecifiers.php
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-04-06 02:23:01 +0900
committernsfisis <nsfisis@gmail.com>2025-04-06 02:23:01 +0900
commitfa9ad79209d85b0677b00ca1d41d070105fec09f (patch)
tree95a81c0909e761e9cecb3cd7333201cb4ac62161 /src/BitOps/UnpackFloatSpecifiers.php
parenta0f17ee6807f9a0605261a11a8ba46c57a9849a0 (diff)
parentde116dceae7ea654df28caab3fd2f3aefdffe188 (diff)
downloadphp-waddiwasi-fa9ad79209d85b0677b00ca1d41d070105fec09f.tar.gz
php-waddiwasi-fa9ad79209d85b0677b00ca1d41d070105fec09f.tar.zst
php-waddiwasi-fa9ad79209d85b0677b00ca1d41d070105fec09f.zip
Merge branch 'fix/float-handling'
Diffstat (limited to 'src/BitOps/UnpackFloatSpecifiers.php')
-rw-r--r--src/BitOps/UnpackFloatSpecifiers.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/BitOps/UnpackFloatSpecifiers.php b/src/BitOps/UnpackFloatSpecifiers.php
new file mode 100644
index 0000000..5a3aa4f
--- /dev/null
+++ b/src/BitOps/UnpackFloatSpecifiers.php
@@ -0,0 +1,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,
+ };
+ }
+}