unwitch-3.0.0: converts between primitives
Safe HaskellNone
LanguageHaskell2010

Unwitch.Convert.Word16

Description

Conversions from Word16.

Synopsis

Conversions

toCInt :: Word16 -> CInt Source #

Widening conversion via Int32, always succeeds.

Unboxed conversions

These use GHC unboxed types and unboxed sums for zero-allocation failure handling. Requires the MagicHash, UnboxedSums and UnboxedTuples language extensions. See the GHC manual on unboxed types.

toWord8# :: Word16 -> (# Word8 | (# #) #) Source #

Unsigned narrowing, roundtrip at Word#

toInt8# :: Word16 -> (# Int8 | (# #) #) Source #

Unsigned->signed, source fits in Int#, roundtrip at Int#

toInt16# :: Word16 -> (# Int16 | (# #) #) Source #

Unsigned->signed, source fits in Int#, roundtrip at Int#