|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
What is the proper method to cast from an unsigned to a signed variable?
For example, suppose that u is an unsigned int and i is a signed int. When u is 0, i should be -32768. When u is 32768, i should be 0. When u is 65535, i should be 32767. Which of the following is correct: i = (unsigned int) u or i = (unsigned int) (u - 32768)? Thanks, David |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pic: Dean and Woodie Signed Saftey Glass | andrew348 | Extra Discussion | 8 | 27-03-2007 16:36 |
| Labview dashboard and multiple variables | Joe Ross | LabView and Data Acquisition | 2 | 15-03-2006 21:55 |
| Math.h and Functions and Variables | amateurrobotguy | Programming | 1 | 26-02-2005 03:19 |
| problems assigning unsigned chars in FRC Code | LoyolaCubs | Programming | 6 | 26-01-2004 23:21 |
| My team is registered and signed up for Rutgers(rookie)! | Erodge | General Forum | 5 | 11-10-2002 10:13 |