Safe Haskell | None |
---|---|
Language | Haskell98 |
Word256 implementation, with arithmetic written in C.
Should work on both little-endian and big-endian architectures, but only tested on little-endian.
- data Word256
- toWord256 :: Integer -> Word256
- fromWord256 :: Word256 -> Integer
- word256Decimal :: Word256 -> String
- word256Hex :: Word256 -> String
- word256ToByteStringLE :: Word256 -> ByteString
- word256ToByteStringBE :: Word256 -> ByteString
- word256ToWord8ListLE :: Word256 -> [Word8]
- makeWord256 :: Integer -> IO Word256
- readWord256 :: Word256 -> IO Integer
- newWord256 :: IO Word256
- withWord256 :: Word256 -> (Ptr Word32 -> IO a) -> IO a
- peekWord256 :: Word256 -> IO [Word32]
- pokeWord256 :: Word256 -> [Word32] -> IO ()
- shiftl256_small :: Word256 -> Int -> Word256
- shiftr256_small :: Word256 -> Int -> Word256
- shiftl256_fullword :: Word256 -> Word256
- shiftr256_fullword :: Word256 -> Word256
- shiftr256by1 :: Word256 -> Word256
- highestSetBit256 :: Word256 -> Int
- not256 :: Word256 -> Word256
- neg256 :: Word256 -> Word256
- add256 :: Word256 -> Word256 -> Word256
- sub256 :: Word256 -> Word256 -> Word256
- mul256 :: Word256 -> Word256 -> Word256
- scale256 :: Word256 -> Word32 -> Word256
- equals256 :: Word256 -> Word256 -> Bool
- lessThan256 :: Word256 -> Word256 -> Bool
- lessOrEqual256 :: Word256 -> Word256 -> Bool
- isEven256 :: Word256 -> Bool
- isOdd256 :: Word256 -> Bool
- twoToThe256 :: Integer
- mod256 :: Integer -> Integer
- littleEndianRollInteger32 :: [Word32] -> Integer
- littleEndianUnrollInteger32 :: Integer -> [Word32]
Documentation
Word256 is represented internally as 8 native 32 bit unsigned integers, in little-endian order.
fromWord256 :: Word256 -> Integer Source #
word256Decimal :: Word256 -> String Source #
word256Hex :: Word256 -> String Source #
word256ToByteStringLE :: Word256 -> ByteString Source #
Converts to a little-endian bytestring
word256ToByteStringBE :: Word256 -> ByteString Source #
Converts to a big-endian bytestring
word256ToWord8ListLE :: Word256 -> [Word8] Source #
Converts to a little-endian sequence of bytes
newWord256 :: IO Word256 Source #
shiftl256_fullword :: Word256 -> Word256 Source #
Shifts left by 32 bits
shiftr256_fullword :: Word256 -> Word256 Source #
Shifts right by 32 bits
shiftr256by1 :: Word256 -> Word256 Source #
Shifts right by 1 bit
highestSetBit256 :: Word256 -> Int Source #
littleEndianRollInteger32 :: [Word32] -> Integer Source #
littleEndianUnrollInteger32 :: Integer -> [Word32] Source #