feat: add shiftLeft and shiftRight for UInt16 and UInt8
The same operations are implemented for UInt32, UInt64 and USize already.
This commit is contained in:
parent
0b146abeb1
commit
225fae9dc2
1 changed files with 10 additions and 0 deletions
|
|
@ -43,6 +43,11 @@ instance : Div UInt8 := ⟨UInt8.div⟩
|
|||
instance : HasLess UInt8 := ⟨UInt8.lt⟩
|
||||
instance : HasLessEq UInt8 := ⟨UInt8.le⟩
|
||||
|
||||
@[extern c inline "#1 << #2"]
|
||||
constant UInt8.shiftLeft (a b : UInt8) : UInt8
|
||||
@[extern c inline "#1 >> #2"]
|
||||
constant UInt8.shiftRight (a b : UInt8) : UInt8
|
||||
|
||||
set_option bootstrap.gen_matcher_code false in
|
||||
@[extern c inline "#1 < #2"]
|
||||
def UInt8.decLt (a b : UInt8) : Decidable (a < b) :=
|
||||
|
|
@ -93,6 +98,11 @@ instance : Div UInt16 := ⟨UInt16.div⟩
|
|||
instance : HasLess UInt16 := ⟨UInt16.lt⟩
|
||||
instance : HasLessEq UInt16 := ⟨UInt16.le⟩
|
||||
|
||||
@[extern c inline "#1 << #2"]
|
||||
constant UInt16.shiftLeft (a b : UInt16) : UInt16
|
||||
@[extern c inline "#1 >> #2"]
|
||||
constant UInt16.shiftRight (a b : UInt16) : UInt16
|
||||
|
||||
set_option bootstrap.gen_matcher_code false in
|
||||
@[extern c inline "#1 < #2"]
|
||||
def UInt16.decLt (a b : UInt16) : Decidable (a < b) :=
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue