Git Product home page Git Product logo

Comments (6)

 avatar commented on April 28, 2024

Good point, I will.

from flatbuffers.

lbensaad avatar lbensaad commented on April 28, 2024

Or may be you could use higher precision for unsigned types, for example for ubyte in buffer use short in java and for ushort in buffer use int in java.

from flatbuffers.

 avatar commented on April 28, 2024

It really depends what the unsigned item represents how you want to deal
with it.

You can convert a byte to a short using: (short)(mybyte & 0xff)

Question is, should the generated API always do that for you, or should you
do that only when necessary. I gravitate to the latter.

On Sat, Jun 21, 2014 at 5:17 AM, bml13 [email protected] wrote:

Or may be you could use higher precision for unsigned types, for example
for ubyte in buffer use short in java and for ushort in buffer use int in
java.


Reply to this email directly or view it on GitHub
#9 (comment).

from flatbuffers.

lbensaad avatar lbensaad commented on April 28, 2024

I think it is the API who should do that always, since the user defined a field as unsigned (eg. ubyte) then he should get it as unsigned value, because if he wanted it signed then he should define as signed (eg. byte). I propose to to return both ushort and ubyte as int. Or it should be an option in the compiler.

from flatbuffers.

 avatar commented on April 28, 2024

You're right, that makes more sense.

But uint as.. long? and ulong still as long?

from flatbuffers.

lbensaad avatar lbensaad commented on April 28, 2024

Yes you can return uint as long, and for ulong you can say in the documentation that it is not supported only long is supported.

from flatbuffers.

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.