Skip to content

Commit

Permalink
Add hexWord32
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewthad committed Nov 1, 2023
1 parent 86398d0 commit 2df5210
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Revision history for bytesmith

## 0.3.11.0 -- 2023-??-??

* Add `Data.Bytes.Parser.Latin.hexWord32`.

## 0.3.10.0 -- 2023-07-25

* Add `mapErrorEffectfully`.
Expand Down
7 changes: 7 additions & 0 deletions src/Data/Bytes/Parser/Latin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ module Data.Bytes.Parser.Latin
-- *** Variable Length
, hexWord8
, hexWord16
, hexWord32
-- *** Fixed Length
, hexFixedWord8
, hexFixedWord16
Expand Down Expand Up @@ -473,6 +474,12 @@ hexWord16 e = Parser
(# s1, r #) -> (# s1, upcastWord16Result r #)
)

hexWord32 :: e -> Parser e s Word32
hexWord32 e = Parser
(\chunk0 s0 -> case hexSmallWordStart e 4294967296 (boxBytes chunk0) s0 of
(# s1, r #) -> (# s1, upcastWord32Result r #)
)

-- | Parse a decimal-encoded 16-bit word. If the number is larger
-- than 65535, this parser fails.
decWord16 :: e -> Parser e s Word16
Expand Down

0 comments on commit 2df5210

Please sign in to comment.