@@ -429,8 +429,20 @@ private static Object readUnsignedLong(RubyContext context, Pointer ptr, int off
429
429
430
430
}
431
431
432
+ @ Primitive (name = "pointer_read_float" )
433
+ public static abstract class PointerReadFloatNode extends PointerPrimitiveArrayArgumentsNode {
434
+
435
+ @ Specialization
436
+ public double readFloat (long address ) {
437
+ final Pointer ptr = new Pointer (address );
438
+ checkNull (ptr );
439
+ return ptr .readFloat (0 );
440
+ }
441
+
442
+ }
443
+
432
444
@ Primitive (name = "pointer_read_double" )
433
- public static abstract class PointerReadDoublePrimitiveNode extends PointerPrimitiveArrayArgumentsNode {
445
+ public static abstract class PointerReadDoubleNode extends PointerPrimitiveArrayArgumentsNode {
434
446
435
447
@ Specialization
436
448
public double readDouble (long address ) {
@@ -843,6 +855,32 @@ private static void writeUnsignedLong(Pointer ptr, int offset, DynamicObject val
843
855
844
856
}
845
857
858
+ @ Primitive (name = "pointer_write_float" )
859
+ public static abstract class PointerWriteFloatNode extends PointerPrimitiveArrayArgumentsNode {
860
+
861
+ @ Specialization
862
+ public DynamicObject writeFloat (long address , double value ) {
863
+ final Pointer ptr = new Pointer (address );
864
+ checkNull (ptr );
865
+ ptr .writeFloat (0 , (float ) value );
866
+ return nil ();
867
+ }
868
+
869
+ }
870
+
871
+ @ Primitive (name = "pointer_write_double" )
872
+ public static abstract class PointerWriteDoubleNode extends PointerPrimitiveArrayArgumentsNode {
873
+
874
+ @ Specialization
875
+ public DynamicObject writeDouble (long address , double value ) {
876
+ final Pointer ptr = new Pointer (address );
877
+ checkNull (ptr );
878
+ ptr .writeDouble (0 , value );
879
+ return nil ();
880
+ }
881
+
882
+ }
883
+
846
884
@ Primitive (name = "pointer_write_pointer" , lowerFixnum = 2 )
847
885
public static abstract class PointerWritePointerPrimitiveNode extends PointerPrimitiveArrayArgumentsNode {
848
886
0 commit comments