Skip to content

[ffi] ulong type looses precision in 64bit mode #6376

@ahorek

Description

@ahorek

Environment Information

Provide at least:
jruby 9.3.0.0-SNAPSHOT (2.6.5) 2020-08-29 34d51ab Java HotSpot(TM) 64-Bit Server VM 11.0.2+9-LTS on 11.0.2+9-LTS +jit [linux-x86_64]

it's represented as "long"

? get_uint32(context) : get_uint64(context);

Expected Behavior
should pass tests

Actual Behavior

  1) Struct tests ulong field r/w (8000000000000000)
     Failure/Error: s[:v] = obj
   
     RangeError:
       bignum too big to convert into `long'
     # ./spec/ffi/struct_spec.rb:346:in `test_num_field'
     # ./spec/ffi/struct_spec.rb:357:in `block in int_field_test'

  2) Struct tests ulong field r/w (ffffffffffffffff)
     Failure/Error: s[:v] = obj

     RangeError:
       bignum too big to convert into `long'
     # ./spec/ffi/struct_spec.rb:346:in `test_num_field'
     # ./spec/ffi/struct_spec.rb:357:in `block in int_field_test'

refs #6375

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions