Re: [opensc-devel] Re: [opensc-commits] svn opensc changed [2968] Added support for MuscleCard applet.

2006-06-27 Thread Stef Hoeben
Nils Larsch wrote: Stef Hoeben wrote: Hi, +void ulong2bebytes(u8 *buf, unsigned long x) +{ +buf[3] = (u8) (x % 256); +x /= 256; +buf[2] = (u8) (x % 256); +x /= 256; +buf[1] = (u8) (x % 256); +buf[0] = (u8) (x / 256); +} I would prefer #define ULONG2BEBYTES(p, x)

Re: [opensc-devel] Re: [opensc-commits] svn opensc changed [2968] Added support for MuscleCard applet.

2006-06-26 Thread Nils Larsch
Stef Hoeben wrote: Hi, +void ulong2bebytes(u8 *buf, unsigned long x) +{ +buf[3] = (u8) (x % 256); +x /= 256; +buf[2] = (u8) (x % 256); +x /= 256; +buf[1] = (u8) (x % 256); +buf[0] = (u8) (x / 256); +} I would prefer #define ULONG2BEBYTES(p, x)do {\ (p)[3] = (

Re: [opensc-devel] Re: [opensc-commits] svn opensc changed [2968] Added support for MuscleCard applet.

2006-06-25 Thread Andreas Jellinghaus
Nils Larsch wrote: instead of defining function for this. I wonder: why? to make the code smaller / faster? the function could be inlined. declaring the function in an internal header file (i.e. not opensc.h) is a good idea I agree. Regards, Andreas ___

Re: [opensc-devel] Re: [opensc-commits] svn opensc changed [2968] Added support for MuscleCard applet.

2006-06-25 Thread Stef Hoeben
Hi, +void ulong2bebytes(u8 *buf, unsigned long x) +{ +buf[3] = (u8) (x % 256); +x /= 256; +buf[2] = (u8) (x % 256); +x /= 256; +buf[1] = (u8) (x % 256); +buf[0] = (u8) (x / 256); +} I would prefer #define ULONG2BEBYTES(p, x)do {\ (p)[3] = (x) & 0xff;\ (p)[

Re: [opensc-devel] Re: [opensc-commits] svn opensc changed [2968] Added support for MuscleCard applet.

2006-06-25 Thread Nils Larsch
Hi Stef, I didn't really follow this thread but ... Stef Hoeben wrote: Hi, yes, getting rid of the endian #defines is one thing. But the edian things are only used for converting an unsigned long into a 4-byte array in big-endian notation and vice versa (+ idem for unsigned shorts) in the fol

Re: [opensc-devel] Re: [opensc-commits] svn opensc changed [2968] Added support for MuscleCard applet.

2006-06-24 Thread Stef Hoeben
Hi, yes, getting rid of the endian #defines is one thing. But the edian things are only used for converting an unsigned long into a 4-byte array in big-endian notation and vice versa (+ idem for unsigned shorts) in the following way: - swap unsigned long if needed - memcpy(byte array, &(th

Re: [opensc-devel] Re: [opensc-commits] svn opensc changed [2968] Added support for MuscleCard applet.

2006-06-19 Thread Ludovic Rousseau
Hello, On 20/06/06, Andreas Jellinghaus <[EMAIL PROTECTED]> wrote: hmm, I don't know how the code looks right now or would look after your change. but I'd prefer to have the code without #ifdef and then have some define macro or function (maybe inline?) swap bytes around (or not). i.e. make the

Re: [opensc-devel] Re: [opensc-commits] svn opensc changed [2968] Added support for MuscleCard applet.

2006-06-19 Thread Andreas Jellinghaus
Hi, hmm, I don't know how the code looks right now or would look after your change. but I'd prefer to have the code without #ifdef and then have some define macro or function (maybe inline?) swap bytes around (or not). i.e. make the code easy to read and only have the macro/function look at the e

Re: [opensc-devel] Re: [opensc-commits] svn opensc changed [2968] Added support for MuscleCard applet.

2006-06-19 Thread Stef Hoeben
Hi, ack. Guess it would be nicer to replace the "change into a bigendian buf" code by some code that doesn't check for endian-ness. E.g. to replace the following code if (BIG_ENDIAN) x = bswap_32(x); memcmp(buffer, &x, 4); by write_bigendian(buffer, x); where static

Re: [opensc-devel] Re: [opensc-commits] svn opensc changed [2968] Added support for MuscleCard applet.

2006-06-19 Thread Ludovic Rousseau
On 16/06/06, Martin Paljak <[EMAIL PROTECTED]> wrote: To build on intel mac attached patch was needed for me (endian.h portability from google gives more insight and alternatives) I am not sure it is the best way if you use configure.in. Autoconf defines the macro AC_C_BIGENDIAN([action-if-tru

Re: [opensc-devel] Re: [opensc-commits] svn opensc changed [2968] Added support for MuscleCard applet.

2006-06-17 Thread Stef Hoeben
Hi Martin, indeed, things don't build on Mac. You'll commit, or want me to do so? Cheers, Stef Martin Paljak wrote: To build on intel mac attached patch was needed for me (endian.h portability from google gives more insight and alternatives) Also removed are some unused header files from c