| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Machine words: basic type and conversion functions |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
module Data.Word64.Base where |
| 10 |
|
| 11 |
open import Algebra.Core using (Op₂) |
| 12 |
open import Data.Nat.Base as ℕ using (ℕ) |
| 13 |
open import Function.Base using (_on_; _∘₂′_) |
| 14 |
open import Level using (zero) |
| 15 |
open import Relation.Binary.Core using (Rel) |
| 16 |
open import Relation.Binary.PropositionalEquality.Core using (_≡_) |
| 17 |
|
| 18 |
------------------------------------------------------------------------ |
| 19 |
-- Re-export built-ins publicly |
| 20 |
|
| 21 |
open import Agda.Builtin.Word public |
| 22 |
using (Word64) |
| 23 |
renaming |
| 24 |
( primWord64ToNat to toℕ |
| 25 |
; primWord64FromNat to fromℕ |
| 26 |
) |
| 27 |
|
| 28 |
liftOp₂ : Op₂ ℕ → Op₂ Word64 |
| 29 |
liftOp₂ op = fromℕ ∘₂′ op on toℕ |
| 30 |
|
| 31 |
infix 4 _≈_ |
| 32 |
_≈_ : Rel Word64 zero |
| 33 |
_≈_ = _≡_ on toℕ |
| 34 |
|
| 35 |
infix 4 _<_ |
| 36 |
_<_ : Rel Word64 zero |
| 37 |
_<_ = ℕ._<_ on toℕ |
| 38 |
|
| 39 |
infix 4 _≤_ |
| 40 |
_≤_ : Rel Word64 zero |
| 41 |
_≤_ = ℕ._≤_ on toℕ |