CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

make int32 with four int8

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jo
Guest







make int32 with four int8
PostPosted: Mon Sep 21, 2009 3:18 am     Reply with quote

Hello,

I've got a problem.... I would make a int32 with four int8..but it's doesn't work and i don't understand why....
Can you help me ???

int32 value;
int8 a;int8 b;int8 c; int8 d;

value = d;
value= value<<8;
value = value + c;
value = value <<16;
value = value + b;
value = value <<24;
value = value + a;
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Sep 21, 2009 3:41 am     Reply with quote

Look sharp. The d value is e.g. shift left by 48 bit positions in your code.
Use the CCS built-in function make32() to perform the conversion without overhead.
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

Re: make int32 with four int8
PostPosted: Tue Sep 22, 2009 2:01 am     Reply with quote

make32(MSB,a,b,LSB); is your best bet.
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group