Converts an integer to fixed point.


fixed itofix(int x);
Converts an integer to fixed point. This is the same thing as x<<16. Remember that overflows (trying to convert an integer greater than 32767) and underflows (trying to convert an integer lesser than -32768) are not detected even in debug builds! The values simply "wrap around". Example:
      fixed number;
      /* This conversion is OK. */
      number = itofix(100);
      ASSERT(fixtoi(number) == 100);
      number = itofix(64000);
      /* This check will fail in debug builds. */
      ASSERT(fixtoi(number) == 64000);
Returns the value of the integer converted to fixed point ignoring overflows.
See Also:

Related Discussions

The following threads each have code containing this keyword: Note: You can click on the numbers to jump directly to the posts that reference this page.

Related Projects

The following projects include source code containing this keyword: