Giter Site home page Giter Site logo

Comments (7)

uleon avatar uleon commented on May 18, 2024

endian-agnostic decoders seem to work for regular numbers. Inf/Nan/etc missing but that's a simple 4/8-byte pattern matching issue. Has anybody got an idea for endian-agnostic decoders?

from open62541.

Stasik0 avatar Stasik0 commented on May 18, 2024

ahm, just an idea, why not using htonl and htonf functions to convert to big-endian and then work with that order? (a htonf is here: http://stackoverflow.com/a/10621440/383834)... using network functions we will not have to rely on compiler switches

from open62541.

uleon avatar uleon commented on May 18, 2024

@stasik: you mean something like

union { UA_Byte i[8]; double d; } tmp;
tmp.d = htonf(value); // convert to standard network big endian 
dst[*pos+0] = tmp.i[7]; ...; dst[*pos+7] = tmp.i[0]; // and eventually to opc ua's little endian

from open62541.

Stasik0 avatar Stasik0 commented on May 18, 2024

Hmmmm.... seems not to be very elegant...

Am 08.04.2014 um 20:16 schrieb uleon [email protected]:

@stasik: you mean something like

union { UA_Byte i[8]; double d; } tmp;
tmp.d = htonf(value); // convert to standard network big endian
dst[_pos+0] = i[7]; ...; dst[_pos+7] = i[0]; // and eventually to opc ua's little endian

Reply to this email directly or view it on GitHub.

from open62541.

jpfr avatar jpfr commented on May 18, 2024

Why not let the precompiler deal with it? Autoconf has AC_C_BIGENDIAN. So we can set our own flag without relying on some nonstandard compiler extension.
Just 4 ifdef/ifndef/endifs around the numeric types and every architecture becomes as fast as possible.

from open62541.

uleon avatar uleon commented on May 18, 2024

I'd like to suggest to call the decoders of UA_UInt32 and UA_UInt64 with a casted pointer. This would work for all architectures that have IEEE745-floats with biased exponents in the same byte order as their ints. PDP would be out at the moment which I consider no problem because I've run out of 8"floppy disks as well.

from open62541.

lock avatar lock commented on May 18, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from open62541.

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.