Re: Generic query about bit opreation in case of 64bit OS.
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=classicalguitar.net; h= subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s= classicalguitar.net; bh=QMhgFM+ZuER9k0bU/EwlVYXeNmU=; b=joLwgejw O5KKrhg9zRxwHlTlyFNm7Zb40mj2RdHBuUYPlO1tb5z6Kl4kf4WazGijm84J6t5B ljDPzal7JOoIVPwhVTrlvXvDYIr94uxnXXFcxffzXHvjPr8oAYSPBiHc+kQpcOvy ggdiq2KyYo0Q0BhHoMCv4OXIKmEC2l+/bPI= Domainkey-signature: a=rsa-sha1; c=nofws; d=classicalguitar.net; h=subject :mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; q=dns; s= classicalguitar.net; b=idn1/Fwse0lnq04y6TpvMuGpX+0OOOo8ew2/Np2TY nK97zULKnK87ZlBfPJ8IfvffYjosOJAdktjIvqDSWBYlNI/3ji5fcUWyN+4JJrn/ JKJ4PeyCt3PafOXIobWG6HIzCusMKxe/01zYji+EF9YUOJJEzkx2prhPw+BSGzNb qo= "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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/brian%40classicalguitar.ne...
This email sent to brian@classicalguitar.net
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Brian Bergstrand