hbcd-1.0: Packed binary-coded decimal (BCD) serialization

Portabilityportable
Stabilityexperimental
Maintainerandrewjkay@gmail.com
Safe HaskellSafe-Infered

Data.BCD.Packed

Description

A module containing packed binary-coded decimal (BCD) serialization functions

Synopsis

Documentation

bytesRequiredSource

Arguments

:: Int

Number of digits (including leading zeros)

-> Int

Number of bytes required

Calculate the bytes required to store a number of digits

packIntegerSource

Arguments

:: Int

Number of digits (including leading zeros)

-> Integer

Value

-> ByteString

Packed BCD

Pack an Integer into a ByteString

unpackIntegerSource

Arguments

:: ByteString

Packed BCD

-> Integer

Value

Unpack an Integer from a ByteString

packDecimalSource

Arguments

:: Int

Number of digits (including leading zeros and decimal places)

-> Word8

Number of decimal places

-> Decimal

Value

-> ByteString

Packed BCD

Pack a Decimal into a ByteString

unpackDecimalSource

Arguments

:: Word8

Number of decimal places

-> ByteString

Packed BCD

-> Decimal

Value

Unpack a Decimal from a ByteString