It is possible that CVI may be performing an unforseen automatic conversion of integer datatypes (char, unsigned char, short, long, etc...) into longs when certain operations take place such as unary bitwise negation. However, ANSI C does not define exactly how compilers are supposed to implement mathematical, logical, and data conversion operations. In fact it is very compiler implementation dependent, and there very well may be a dozen different implementations of these operations on the market.
In this case you expected the char variable to be treated exactly as it was defined with no automatic casting done, but if this is observed to not be what is actually happening then you are always recommended in most compilers to explicitly cast your types to match the
operation you want performed.
For example place the following casts on the data you wish to use:
~(char)mychar;
~(short)myshort;
~(unsigned short)myunsignedshort;
Jason F.
Applications Engineer
National Instruments
www.ni.com/ask