Right now this is how I'm doing it, but it definitely doesn't look very... 
efficient:

(Value is just a uint64)
    
    
    proc writeValue(v:Value) =
        CD.add(Byte(v shr 56))
        CD.add(Byte(v and Value(0x00ff000000000000)))
        CD.add(Byte(v and Value(0x0000ff0000000000)))
        CD.add(Byte(v and Value(0x000000ff00000000)))
        CD.add(Byte(v and Value(0x00000000ff000000)))
        CD.add(Byte(v and Value(0x0000000000ff0000)))
        CD.add(Byte(v and Value(0x000000000000ff00)))
        CD.add(Byte(v and Value(0x00000000000000ff)))
    
    template readValue():Value =
        inc(IP,8); (Value(CD[IP-8]) shl 56) or (Value(CD[IP-7]) shl 48) or 
(Value(CD[IP-6]) shl 40) or (Value(CD[IP-5]) shl 32) or (Value(CD[IP-4]) shl 
24) or (Value(CD[IP-3]) shl 16) or (Value(CD[IP-2]) shl 8) or Value(CD[IP-1])
    
    
    Run

Any suggestions?

Reply via email to