xref: /imagick/util/Float32Info.php (revision 77c49f3d)
1<?php
2
3namespace HexFloat;
4
5// Mirrored from https://github.com/Danack/HexFloat
6
7class Float32Info
8{
9    //Sign bit: 1 bit
10    private $sign;
11
12    //Exponent: 11 bits
13    private $exponent;
14
15    //Mantissa precision: 53 bits (52 explicitly stored)
16    private $mantissa;
17
18    public function __construct(
19        $sign,
20        $exponent,
21        $mantissa
22    ) {
23        // TODO - check lengths
24        $this->sign = $sign;
25        $this->exponent = $exponent;
26        $this->mantissa = $mantissa;
27    }
28
29    public function getSign()
30    {
31        return $this->sign;
32    }
33
34    public function getExponent()
35    {
36        return $this->exponent;
37    }
38
39    public function getMantissa()
40    {
41        return $this->mantissa;
42    }
43}
44