Verified Commit e1eb2b96 authored by Camil Staps's avatar Camil Staps 🚀

Add {32#} instances for Array for Int and Real

parent 18a26c2a
...@@ -64,4 +64,16 @@ instance Array {#} a where ...@@ -64,4 +64,16 @@ instance Array {#} a where
createArray :: !Int !e -> *{# e} createArray :: !Int !e -> *{# e}
replace :: !*{# .e} !Int !.e -> *(!.e, !*{# .e}) replace :: !*{# .e} !Int !.e -> *(!.e, !*{# .e})
instance Array {32#} Int where
uselect :: !u:{32# Int} !Int -> *(!Int, !u:{32# Int})
update :: !*{32# e:Int} !Int !e:Int -> *{32# e:Int}
createArray :: !Int !Int -> *{32# Int}
replace :: !*{32# e:Int} !Int !e:Int -> *(!e:Int, !*{32# e:Int})
instance Array {32#} Real where
uselect :: !u:{32# Real} !Int -> *(!Real, !u:{32# Real})
update :: !*{32# e:Real} !Int !e:Real -> *{32# e:Real}
createArray :: !Int !Real -> *{32# Real}
replace :: !*{32# e:Real} !Int !e:Real -> *(!e:Real, !*{32# e:Real})
instance Array {} a instance Array {} a
...@@ -424,6 +424,102 @@ instance Array {#} a where ...@@ -424,6 +424,102 @@ instance Array {#} a where
halt halt
} }
instance Array {32#} Real where
select arr index =
code
{
select REAL32 0 1
}
uselect :: !u:{32# Real} !Int -> *(!Real, !u:{32# Real})
uselect arr index =
code
{
push_a 0
select REAL32 0 1
}
size arr =
code
{
push_arraysize REAL32 0 1
}
usize arr =
code
{
push_a 0
push_arraysize REAL32 0 1
}
update :: !*{32# e:Real} !Int !e:Real -> *{32# e:Real}
update arr index el =
code
{
update REAL32 0 1
}
createArray :: !Int !Real -> *{32# Real}
createArray size el =
code
{
create_array REAL32 0 1
}
replace :: !*{32# e:Real} !Int !e:Real -> *(!e:Real, !*{32# e:Real})
replace arr index el =
code
{
replace REAL32 0 1
}
_createArray size =
code
{
create_array_ REAL32 0 1
}
instance Array {32#} Int where
select arr index =
code
{
select INT32 0 1
}
uselect :: !u:{32# Int} !Int -> *(!Int, !u:{32# Int})
uselect arr index =
code
{
push_a 0
select INT32 0 1
}
size arr =
code
{
push_arraysize INT32 0 1
}
usize arr =
code
{
push_a 0
push_arraysize INT32 0 1
}
update :: !*{32# e:Int} !Int !e:Int -> *{32# e:Int}
update arr index el =
code
{
update INT32 0 1
}
createArray :: !Int !Int -> *{32# Int}
createArray size el =
code
{
create_array INT32 0 1
}
replace :: !*{32# e:Int} !Int !e:Int -> *(!e:Int, !*{32# e:Int})
replace arr index el =
code
{
replace INT32 0 1
}
_createArray size =
code
{
create_array_ INT32 0 1
}
instance Array {!} a where instance Array {!} a where
select arr index = select arr index =
code code
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment