Mercurial > repos > rhope
changeset 124:8aedae4f4ddd
Add support for Int32 as Dictionary key
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 28 Oct 2010 21:05:50 -0400 |
parents | 4e4ecbca0b5d |
children | e556416e9c91 |
files | kernel.rhope |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/kernel.rhope Thu Oct 28 21:05:24 2010 -0400 +++ b/kernel.rhope Thu Oct 28 21:05:50 2010 -0400 @@ -353,3 +353,24 @@ } } +Dict Type ID@Int32[num:out] +{ + out <- ID[Int32()] +} + +Dict Bits@Int32[num,idx:out,invalid] +{ + ,invalid <- If[[idx]<[4]] + { + out <- Abs UInt[[[num]RShift[[[3]-[idx]]LShift[3]]]&[255]] + } +} + +From Dict Key@Int32[num,data:out] +{ + out <- [[[[Int32[Trunc UInt16[[data]Index[0]]]]LShift[24] + ]|[[Int32[Trunc UInt16[[data]Index[1]]]]LShift[16]] + ]|[[Int32[Trunc UInt16[[data]Index[2]]]]LShift[8]] + ]|[Int32[Trunc UInt16[[data]Index[3]]]] +} +