add decWord for machine-sized words
This commit is contained in:
parent
2e8d4279c7
commit
071b55568d
2 changed files with 14 additions and 0 deletions
|
@ -32,6 +32,7 @@ module Data.ByteArray.Builder
|
|||
, word32Dec
|
||||
, word16Dec
|
||||
, word8Dec
|
||||
, wordDec
|
||||
, int64Dec
|
||||
, int32Dec
|
||||
, int16Dec
|
||||
|
@ -282,6 +283,12 @@ word16Dec w = fromBounded Nat.constant (Bounded.word16Dec w)
|
|||
word8Dec :: Word8 -> Builder
|
||||
word8Dec w = fromBounded Nat.constant (Bounded.word8Dec w)
|
||||
|
||||
-- | Encodes an unsigned machine-sized integer as decimal.
|
||||
-- This encoding never starts with a zero unless the
|
||||
-- argument was zero.
|
||||
wordDec :: Word -> Builder
|
||||
wordDec w = fromBounded Nat.constant (Bounded.wordDec w)
|
||||
|
||||
-- | Encode a double-floating-point number, using decimal notation or
|
||||
-- scientific notation depending on the magnitude. This has undefined
|
||||
-- behavior when representing @+inf@, @-inf@, and @NaN@. It will not
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue