module Termbox.Bindings.Hs.Internal.Prelude
  ( charToWord32,
    cintToInt,
    intToCInt,
    word32ToChar,
  )
where

import qualified Data.Char as Char
import Data.Word (Word32)
import Foreign.C.Types (CInt)

charToWord32 :: Char -> Word32
charToWord32 :: Char -> Word32
charToWord32 =
  forall a b. (Integral a, Num b) => a -> b
fromIntegral @Int @Word32 (Int -> Word32) -> (Char -> Int) -> Char -> Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
Char.ord
{-# INLINE charToWord32 #-}

word32ToChar :: Word32 -> Char
word32ToChar :: Word32 -> Char
word32ToChar =
  Int -> Char
Char.chr (Int -> Char) -> (Word32 -> Int) -> Word32 -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral @Word32 @Int
{-# INLINE word32ToChar #-}

cintToInt :: CInt -> Int
cintToInt :: CInt -> Int
cintToInt =
  CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
{-# INLINE cintToInt #-}

intToCInt :: Int -> CInt
intToCInt :: Int -> CInt
intToCInt =
  Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral
{-# INLINE intToCInt #-}