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)
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] = (
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
___
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)[
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
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
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
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
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
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
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
11 matches
Mail list logo