hashcode* for structs
parent
2d37ac31be
commit
43f81d3835
|
@ -184,6 +184,14 @@ STRUCT: struct-test-equality-2
|
||||||
] with-destructors
|
] with-destructors
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
[ t ] [
|
||||||
|
[
|
||||||
|
struct-test-equality-1 <struct> 5 >>x
|
||||||
|
struct-test-equality-1 malloc-struct &free 5 >>x
|
||||||
|
[ hashcode ] bi@ =
|
||||||
|
] with-destructors
|
||||||
|
] unit-test
|
||||||
|
|
||||||
STRUCT: struct-test-ffi-foo
|
STRUCT: struct-test-ffi-foo
|
||||||
{ x int }
|
{ x int }
|
||||||
{ y int } ;
|
{ y int } ;
|
||||||
|
|
|
@ -6,7 +6,7 @@ combinators combinators.short-circuit combinators.smart
|
||||||
functors.backend fry generalizations generic.parser kernel
|
functors.backend fry generalizations generic.parser kernel
|
||||||
kernel.private lexer libc locals macros make math math.order parser
|
kernel.private lexer libc locals macros make math math.order parser
|
||||||
quotations sequences slots slots.private struct-arrays vectors
|
quotations sequences slots slots.private struct-arrays vectors
|
||||||
words compiler.tree.propagation.transforms ;
|
words compiler.tree.propagation.transforms specialized-arrays.direct.uchar ;
|
||||||
FROM: slots => reader-word writer-word ;
|
FROM: slots => reader-word writer-word ;
|
||||||
IN: classes.struct
|
IN: classes.struct
|
||||||
|
|
||||||
|
@ -35,7 +35,10 @@ M: struct equal?
|
||||||
{
|
{
|
||||||
[ [ class ] bi@ = ]
|
[ [ class ] bi@ = ]
|
||||||
[ [ >c-ptr ] [ [ >c-ptr ] [ byte-length ] bi ] bi* memory= ]
|
[ [ >c-ptr ] [ [ >c-ptr ] [ byte-length ] bi ] bi* memory= ]
|
||||||
} 2&& ;
|
} 2&& ; inline
|
||||||
|
|
||||||
|
M: struct hashcode*
|
||||||
|
[ >c-ptr ] [ byte-length ] bi <direct-uchar-array> hashcode* ; inline
|
||||||
|
|
||||||
: struct-prototype ( class -- prototype ) "prototype" word-prop ; foldable
|
: struct-prototype ( class -- prototype ) "prototype" word-prop ; foldable
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue