safe conversions?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

safe conversions?

2,014 Views
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
Labels (1)
0 Kudos
1 Reply

527 Views
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 Kudos