safe conversions?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

safe conversions?

2,480 次查看
javi
Contributor I
Dear all,

I am looking for some code samples before trying to reinvent the wheel. I need to convert from several numeric types to other numeric types. I mean,

from char to int
from int to char
from unsigned int to int
from int to unsigned int
...
from float to int
from int to float.
..and more of these kind.

I need to check that no overflows underflows happen, using asserts. So I am looking for some code sample that can do what I need.

I am also looking for a string to numeric(int, char, float) and numeric to string converter.

I would appreciate any info,

thanks a lot and best regards,

otomi
标签 (1)
0 项奖励
回复
1 回复

993 次查看
J2MEJediMaster
Specialist I
I'm not clear on this request. If you're using a development tool set that has high-level language support such as C, then you'd just use its math libraries to handle the data conversions. Anything else is definitely reinventing the wheel. Or are you looking for assembly code?

What sort of hardware target and tools are you using?

---Tom
0 项奖励
回复