Skip to content

Commit

Permalink
rename float types
Browse files Browse the repository at this point in the history
  • Loading branch information
biggus-developerus committed Dec 26, 2024
1 parent 9b9ece0 commit 69583a1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ from packer import *
class SimpleStruct:
int32_member: Pack[int32]
int8_member: Pack[int8]
float_member: OptionalPack[float]
float_member: OptionalPack[float32]

s = SimpleStruct(3, 2, None)
s.pack() # bytearray(b'\x03\x00\x00\x00\x02')
Expand Down
8 changes: 4 additions & 4 deletions packer/pack_types/pack_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"uint16",
"uint32",
"uint64",
"float",
"double",
"float32",
"float64",
)

from typing import Type
Expand All @@ -26,5 +26,5 @@
uint32 = Type[UInt["L4"]]
uint64 = Type[UInt["L8"]]

float = Type[Float[4]]
double = Type[Float[8]]
float32 = Type[Float[4]]
float64 = Type[Float[8]]
2 changes: 1 addition & 1 deletion tests/test_simple_packing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def test_float_packing() -> None:
@packable
@dataclasses.dataclass
class FloatStruct:
float_member: Pack[float]
float_member: Pack[float32]

f = FloatStruct(0.5)
assert f.pack() == struct.pack("f", 0.5)
Expand Down

0 comments on commit 69583a1

Please sign in to comment.