05-21-2024 09:33 AM - edited 05-21-2024 09:34 AM
Hi I am trying to convert a U32 two's complement number back to a negative integer.
Can someone guide me on this?
Solved! Go to Solution.
05-21-2024 09:45 AM
Hi Satvikpai,
@Satvikpai wrote:
Hi I am trying to convert a U32 two's complement number back to a negative integer.
Can someone guide me on this?
An U32 is (as the name says) an UNSIGNED value, so it cannot be negative!
Maybe you want to convert the U32 value into an I32 value (using ToI32)?
05-21-2024 10:57 AM - edited 05-21-2024 10:57 AM
If you somehow got a signed integer stored in a U32 (read from a file to the wrong type?), you can use a type cast to convert it to I32:
05-21-2024 01:27 PM
Hi JJohn,
@jjohn1 wrote:
you can use a type cast to convert it to I32:
ToI32 does the very same job - and (probably) more efficient and with less BD space…
05-21-2024 03:28 PM
Thanks for the note onToI32. I did not know how it would handle values with the sign bit set. On a good day you learn something new. Thanks!