| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Word64: simple bindings to Haskell types and functions |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible #-} |
| 8 |
|
| 9 |
module Data.Word64.Primitive where |
| 10 |
|
| 11 |
open import Agda.Builtin.Bool using (Bool) |
| 12 |
open import Agda.Builtin.Nat using (Nat) |
| 13 |
open import Agda.Builtin.String using (String) |
| 14 |
open import Agda.Builtin.Word using (Word64) |
| 15 |
|
| 16 |
postulate |
| 17 |
testBit : Word64 → Nat → Bool |
| 18 |
setBit : Word64 → Nat → Word64 |
| 19 |
clearBit : Word64 → Nat → Word64 |
| 20 |
show : Word64 → String |
| 21 |
|
| 22 |
{-# FOREIGN GHC import GHC.Word #-} |
| 23 |
{-# FOREIGN GHC import qualified Data.Bits as B #-} |
| 24 |
{-# FOREIGN GHC import qualified Data.Text as T #-} |
| 25 |
|
| 26 |
{-# COMPILE GHC testBit = \ w -> B.testBit w . fromIntegral #-} |
| 27 |
{-# COMPILE GHC setBit = \ w -> B.setBit w . fromIntegral #-} |
| 28 |
{-# COMPILE GHC clearBit = \ w -> B.clearBit w . fromIntegral #-} |
| 29 |
{-# COMPILE GHC show = T.pack . Prelude.show #-} |