unsigned short* vs unsigned long* -- help!
所在版块:社会百科 发贴时间:2003-08-22 13:40

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
Ge Wei Da Xia,

I'm writing a c program which utilizes someone else's function. This function takes in a bit vector by "unsigned short * " pointer. However, the corresponding bit vector I pass to this function is constructed with "unsigned long * " pointer. Therefore, in Linux and Windows, because of the endian convention, the bit vector passed over is not what I want. For example, under unsigned long pointer, I have 0x12345678. But when casted into unsigned short, it becomes 0x5678 0x1234.

Now, the only thing I can think of is to either change my own program (which needs quite a lot of changes) or change that person's program (which needs just as much changes, and the code is hard to understand).

So I'm wondering, does any of the wizards here have better ways of dealing with this?

Thanks very very much!
.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

Put your OWN COOL signature here!
 相关帖子 我要回复↙ ↗回到正文
unsigned short* vs unsigned long* -- help! Clex   (820 bytes , 348reads )
copy ur input data to a buffer 小诸葛   (119 bytes , 214reads )