change-c-type-accessors ( n ? c-type -- c-type' )


Vocabulary
alien.endian

Definition
USING: accessors alien.accessors kernel math math.bitwise words
;

IN: alien.endian

: change-c-type-accessors ( n ? c-type -- c-type' )
endian-c-type>c-type-symbol "c-type" word-prop
clone -rot over 8 = [
[
nip [
[
[
alien-unsigned-4 4 f byte-reverse
32 shift
] [ 4 + alien-unsigned-4 4 f byte-reverse ]
2bi bitor
]
] dip [ [ 64 >signed ] compose ] when >>getter drop
] [
[ byte-reverse ] 2curry [ 2dip ] curry
[ prepose ] curry change-setter
] 3bi
] [
[
[ byte-reverse ] 2curry [ compose ] curry
change-getter drop
] [
[ byte-reverse ] 2curry [ 2dip ] curry
[ prepose ] curry change-setter
] 3bi
] if ;