From: Arno P. <ar...@pu...> - 2011-04-05 23:15:11
|
A byte is a signed 8 bit value that needs to be sign-extended to 32 bits when loaded into a register. Arno On Apr 5, 2011, at 3:30 PM, Panayotis Katsaloulis <pan...@pa...> wrote: > > On Apr 5, 2011, at 8:49 PM, Arno Puder wrote: > >> >> things are a little trickier. According to section 2.4.1 of the Java >> Specs: "The integral types are byte, short, int, and long, whose values >> are 8-bit, 16-bit, 32-bit, and 64-bit signed two's-complement integers, >> respectively, and char, whose values are 16-bit unsigned integers >> representing Unicode characters" >> >> Then in Section 3.11.1 of the Java spec it says: "Note that most >> instructions in Table 3.2 do not have forms for the integral types byte, >> char, and short. None have forms for the boolean type. Compilers encode >> loads of literal values of types byte and short using Java virtual >> machine instructions that sign-extend those values to values of type int >> at compile time or run time. Loads of literal values of types boolean >> and char are encoded using instructions that zero-extend the literal to >> a value of type int at compile time or run time." >> >> So, you are correct that a byte is a signed 8-bit value, however it >> needs to be properly sign extended. In the C backend I already use >> typedef's consistently, so it should be easy to fix. The Objective-C >> backend is not as cleanly implemented. >> >> Arno >> > > > So, the problem remains, should "byte" be a signed or unsigned char under ObjC backend, and especially in the Byte methods? > My understanding is that it is sometimes a signed integer, but in any case, it is *not* an unsigned char. > ------------------------------------------------------------------------------ > Xperia(TM) PLAY > It's a major breakthrough. An authentic gaming > smartphone on the nation's most reliable network. > And it wants your games. > http://p.sf.net/sfu/verizon-sfdev > _______________________________________________ > Xmlvm-developers mailing list > Xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlvm-developers |