1 USING: alien.c-types alien.data assocs combinators.smart kernel math
3 IN: tools.image-analyzer.relocations
10 : rel-type ( uint -- type )
11 -28 shift 0xf bitand ;
13 : rel-class ( uint -- class )
14 -24 shift 0xf bitand ;
16 : rel-offset ( uint -- offset )
19 : rel-nr-params ( uint -- n )
22 : uint>relocation ( uint -- relocation )
23 { [ rel-type ] [ rel-class ] [ rel-offset ] [ rel-nr-params ] }
26 : byte-array>relocations ( byte-array -- relocations )
27 uint cast-array [ uint>relocation ] { } map-as ;
29 : load-relative-value ( byte-array relocation -- value )
30 third [ [ 4 - ] keep rot subseq int cast-array first ] keep + ;