Giter Club home page Giter Club logo

Comments (4)

headius avatar headius commented on September 13, 2024

It does appear that this logic does not support 64-bit values at all. Changing the toString is only one small part of it; note that NumberField.longValue also calls intValue and upcasts it to a long. It's unclear to me if we can just switch all of these classes to actually treat the contained value as a long.

Thoughts?

from jnr-ffi.

ahilananantha avatar ahilananantha commented on September 13, 2024

AFAICT, NumberField.longValue is always overridden in the places that matter, e.g. IntegerAlias, Signed64, Unsigned64, SignedLong, UnsignedLong. Perhaps you could make all those methods abstract to avoid confusion?

from jnr-ffi.

ahilananantha avatar ahilananantha commented on September 13, 2024

And calling longValue() will still be wrong if the number is a float. Looks like it's more correct to make the method abstract.

from jnr-ffi.

ahilananantha avatar ahilananantha commented on September 13, 2024

The shortest fix seems to be to copy over the toString() method of Signed64 / Unsigned64 / SignedLong / UnsignedLong into IntegerAlias and Unsigned32. The delicate series of overrides of longValue() and toString() in derived classes seems to handle every other case.

Alternately we can make longValue() and toString() abstract so that the code is easier to read but lengthier.

from jnr-ffi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.