• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Generic query about bit opreation in case of 64bit OS.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generic query about bit opreation in case of 64bit OS.


  • Subject: Re: Generic query about bit opreation in case of 64bit OS.
  • From: Brian Bergstrand <email@hidden>
  • Date: Tue, 1 Jun 2010 15:10:35 +0300

"unsigned long" in LP64 is not 32bits, it is 64bits. Use "unsigned int" for 32bit storage in LP32 and LP64.

On Jun 1, 2010, at 2:47 PM, Arnab Ganguly wrote:

> Dear All,
>
> I am having two below functions.
>
>
>
> void for16(unsigned char *&walker, uint16 &value)
> {
>   uint16 result;
>
>   result = ((uint16) *walker++) << 0;
>   result |= ((uint16) *walker++) << 8;
>
>
>   value = result;
> }
>
>
> Here uint16 is unsigned short.
>
>
> void for32(unsigned char *&walker, uint32 &value)
> {
>   uint32 result;
>
>     result = ((uint32) *walker++) << 0;
>     result |= ((uint32) *walker++) << 8;
>     result |= ((uint32) *walker++) << 16;
>     result |= ((uint32) *walker++) << 24;
>
>
>
>   value = result;
> }
>
> Here uint32 is unsigned long.
>
>
> I am not getting same resultant value in case of 32bit and 64bit.How can I make the above code return same result irrespective of 32bit or 64bit machine.I am not clear about the code logic also.Please help me understanding the same.
> Thanks in advance.
> -R
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Generic query about bit opreation in case of 64bit OS.
      • From: Alastair Houghton <email@hidden>
    • Re: Generic query about bit opreation in case of 64bit OS.
      • From: Arnab Ganguly <email@hidden>
References: 
 >Generic query about bit opreation in case of 64bit OS. (From: Arnab Ganguly <email@hidden>)

  • Prev by Date: Generic query about bit opreation in case of 64bit OS.
  • Next by Date: Re: Generic query about bit opreation in case of 64bit OS.
  • Previous by thread: Generic query about bit opreation in case of 64bit OS.
  • Next by thread: Re: Generic query about bit opreation in case of 64bit OS.
  • Index(es):
    • Date
    • Thread