Re: macro help
- From: Army1987 <army1987@xxxxxxxxx>
- Date: Sun, 30 Sep 2007 14:39:27 +0200
On Sun, 30 Sep 2007 04:14:19 -0700, William Pursell wrote:
On 30 Sep, 10:26, inftoc...@xxxxxxxxx wrote:
I wrote a macro to read 8 bytes from a byte stream. Am not
sure if it is working ok. Can anyone please point out if there looks
to be a problem!
#define READ64(b) ( (uint64_t(*b)) << 56) + ((uint64_t(*(b+1))) << 48)
+ ((uint64_t(*(b+2))) << 40) +((uint64_t(*(b+3))) << 32)+((uint64_t(*(b
+4))) << 24) + (( uint64_t(*(b+5))) << 16) + (( uint64_t(*(b+6))) <<
8) + ( *(b+7))
Here b is a pointer to an unsigned char.
Lots of problems:
The endianness of the machine will have
an impact, certainly.
I think he did that to have the same format on all machines.
Otherwise he could use memcpy().
--
Army1987 (Replace "NOSPAM" with "email")
A hamburger is better than nothing.
Nothing is better than eternal happiness.
Therefore, a hamburger is better than eternal happiness.
.
- References:
- macro help
- From: inftoconc
- Re: macro help
- From: William Pursell
- macro help
- Prev by Date: Re: what does this warning mean ?
- Next by Date: Re: Macro for supplying memset with an unsigned char
- Previous by thread: Re: macro help
- Next by thread: Re: macro help
- Index(es):
Relevant Pages
|