@@ -171,8 +171,7 @@ bitsSDiv' {n=n} x y with (nextBits n)
171 | Bits32 = prim__sdivB32 x y
171 | Bits32 = prim__sdivB32 x y
172 | Bits64 = prim__sdivB64 x y
172 | Bits64 = prim__sdivB64 x y
175−partial
174+public partial
176bitsSDiv : Bits n -> Bits n -> Bits n
175bitsSDiv : Bits n -> Bits n -> Bits n
177bitsSDiv (MkBits x) (MkBits y) = MkBits (bitsSDiv' x y)
176bitsSDiv (MkBits x) (MkBits y) = MkBits (bitsSDiv' x y)
@@ -184,8 +183,7 @@ bitsUDiv' {n=n} x y with (nextBits n)
184 | Bits32 = prim__udivB32 x y
183 | Bits32 = prim__udivB32 x y
185 | Bits64 = prim__udivB64 x y
184 | Bits64 = prim__udivB64 x y
188−partial
186+public partial
189bitsUDiv : Bits n -> Bits n -> Bits n
187bitsUDiv : Bits n -> Bits n -> Bits n
190bitsUDiv (MkBits x) (MkBits y) = MkBits (bitsUDiv' x y)
188bitsUDiv (MkBits x) (MkBits y) = MkBits (bitsUDiv' x y)
@@ -197,8 +195,7 @@ bitsSRem' {n=n} x y with (nextBits n)
197 | Bits32 = prim__sremB32 x y
195 | Bits32 = prim__sremB32 x y
198 | Bits64 = prim__sremB64 x y
196 | Bits64 = prim__sremB64 x y
201−partial
198+public partial
202bitsSRem : Bits n -> Bits n -> Bits n
199bitsSRem : Bits n -> Bits n -> Bits n
203bitsSRem (MkBits x) (MkBits y) = MkBits (bitsSRem' x y)
200bitsSRem (MkBits x) (MkBits y) = MkBits (bitsSRem' x y)
@@ -210,8 +207,7 @@ bitsURem' {n=n} x y with (nextBits n)
210 | Bits32 = prim__uremB32 x y
207 | Bits32 = prim__uremB32 x y
211 | Bits64 = prim__uremB64 x y
208 | Bits64 = prim__uremB64 x y
214−partial
210+public partial
215bitsURem : Bits n -> Bits n -> Bits n
211bitsURem : Bits n -> Bits n -> Bits n
216bitsURem (MkBits x) (MkBits y) = MkBits (bitsURem' x y)
212bitsURem (MkBits x) (MkBits y) = MkBits (bitsURem' x y)
@@ -271,12 +267,26 @@ public
271bitsGt : (x : Bits n) -> (y : Bits n) -> Bool
267bitsGt : (x : Bits n) -> (y : Bits n) -> Bool
272bitsGt (MkBits x) (MkBits y) = bitsGt' x y /= 0
268bitsGt (MkBits x) (MkBits y) = bitsGt' x y /= 0
270+instance Eq (Bits n) where
273+instance Ord (Bits n) where
278+ compare x y = if x `bitsLt` y
280+ else if x `bitsEq` y
275bitsToStr : Bits n -> String
285bitsToStr : Bits n -> String
276bitsToStr {n=n} x = helper n x
286bitsToStr {n=n} x = helper n x
278 helper : Nat -> Bits n -> String
288 helper : Nat -> Bits n -> String
279− helper (S x) b = (if bitsAnd (bitsShl (intToBits 1) (intToBits (cast x))) b `bitsEq` (intToBits 0)
289+ helper (S x) b = (if bitsAnd (bitsShl (intToBits 1) (intToBits (cast x))) b == (intToBits 0)
282 ) ++ helper x b
292 ) ++ helper x b