32 lines
524 B
Text
32 lines
524 B
Text
|
|
||
|
export {
|
||
|
let fetch-word :
|
||
|
&machine.Word ~ <AlignedPtr 8> ~ machine.Address ~ machine.UInt64
|
||
|
-> machine.Word;
|
||
|
|
||
|
let fetch-byte :
|
||
|
&<Bits 8>
|
||
|
~ <AlignedPtr 8>
|
||
|
~ machine.Address
|
||
|
~ machine.UInt64
|
||
|
-> <Bits 8>
|
||
|
~ machine.Word
|
||
|
= λ ptr ↦ {
|
||
|
fetch-word (align ptr);
|
||
|
bit-shr (* 8 (ptr % 8));
|
||
|
bit-and 0xff;
|
||
|
};
|
||
|
|
||
|
let fetch-nibble
|
||
|
: &<Bits 4>
|
||
|
~ <AlignedPtr 4>
|
||
|
~ machine.UInt64
|
||
|
|
||
|
-> <Bits 4>
|
||
|
~ machine.Word
|
||
|
= λ idx ↦ {
|
||
|
|
||
|
};
|
||
|
}
|
||
|
|