Giter Club home page Giter Club logo

Comments (10)

kroggen avatar kroggen commented on September 14, 2024

Hi!

Thank you for your contribution.

Please checkout the updates and make a new test. Then tell me if it was solved.

from binn.

csstup avatar csstup commented on September 14, 2024

Sure! I'll give it a try tomorrow. Thanks for the quick response!.

from binn.

liteserver avatar liteserver commented on September 14, 2024

Hi Corey,

Is it OK now?

from binn.

csstup avatar csstup commented on September 14, 2024

Sorry for taking so long to reply. Changes in job.

I took your latest update and made the following changes:

#if defined(__APPLE__) || defined(_WIN32)
#define __BIG_ENDIAN      0x1000
#define __LITTLE_ENDIAN   0x0001
#define __BYTE_ORDER    __LITTLE_ENDIAN
#elif defined (_AIX)
#include <sys/machine.h>
#define __BIG_ENDIAN      BIG_ENDIAN
#define __LITTLE_ENDIAN   LITTLE_ENDIAN
#define __BYTE_ORDER      BYTE_ORDER
#else
#include <endian.h>
#endif

Here's the relevant part of <sys/machine.h> on AIX:

/*
 * Definitions for byte order,
 * according to byte significance from low address to high.
 */
#define LITTLE_ENDIAN   1234    /* least-significant byte first (vax)         */
#define BIG_ENDIAN      4321    /* most-significant byte first (IBM, net)     */
#define PDP_ENDIAN      3412    /* LSB first in word, MSW first in long (pdp) */

#define BYTE_ORDER      BIG_ENDIAN

I can compile without issue now. I'm testing the result now.

Thanks!

from binn.

csstup avatar csstup commented on September 14, 2024

Running the tests, it looks like at least some of it assumes you're on LE.

So on BE, the test_endianess() function asserts immediately.

void test_endianess() {
  unsigned short vshort1, vshort2;
  unsigned int   vint1, vint2;
  uint64 value1, value2;

  printf("testing endianess... ");

  /* tobe16 */
  vshort1 = 0x1122;
  vshort2 = tobe16(vshort1);
  assert(vshort2 == 0x2211);
  vshort2 = tobe16(vshort2);
  assert(vshort2 == vshort1);

Should we make the tests endian agnostic?

from binn.

kroggen avatar kroggen commented on September 14, 2024

Hi Corey,

Thank you!

Indeed, the test should test the endianess conversion on both architectures. The expected values are different for each. The expected values should be unmodified on BE.

from binn.

kroggen avatar kroggen commented on September 14, 2024

I updated the endianess test case.

Do you want to send a pull request with your contribution for AIX?

If yes, it must contain only those modifications on binn.c to be accepted. It should not contain formatting differences on the file.

If you don't want then I can insert them.

from binn.

csstup avatar csstup commented on September 14, 2024

I'll give the test case a try.

My machine doesn't have access to the internet, so I can't do git work with it. Its probably just as easy for you to add the changes.

Thanks!

from binn.

kroggen avatar kroggen commented on September 14, 2024

OK, I updated it.

The leading underscores were used because the endianess checking was based on the Google Chrome source, and it is used on Linux. But it is really becoming weird now. At least they are not exported on binn.h

from binn.

kroggen avatar kroggen commented on September 14, 2024

The macros were renamed

from binn.

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.