Re: Java to C Structure Communication
Jeff Kesselman <[email protected]> Thu, 7 Feb 2008 13:25:05 -0500
| Newsgroups | gmane.comp.windows.devel.java.advanced |
|---|---|
| Message-ID | <[email protected]> |
One more comment on signeds... You can sometimes get away with justs tuffing a C unsigned into a Java int dependign on what your doing with it. Math and comparisons wont be the same, but Java *does* have unsigned shift operators that work on the int type. Jeff Kesselman wrote: > Patrick Schneider wrote: >> I was under the impression that Java integral types are signed >> two's-complement integers... >> >> What did you mean by this: >> >> >>> Java int is an unsigned 32 bit number. >>> >> >> ? ... or am I missing something? >> > > Nope your right, brain fart. > > All Java ints are signed. > > So to do an unsigned, you need to go to a bigger type. > > If its already a 32 bit number, I guess youll need to read it as bytes > and assemble it as > a BigInt. Or give uup on the high bit if your sure the numerbs never > really get that high. > Thats what I did for my NWN data loader, just truncated the unsigned to > 31 bits. > > JK > > > -- > ======================================================================= > Journalism 101: The difference between news and a press release > > News tells you what the reporter thinks is true. > > A press release tells you what a company wants *you* to think is true. > > Only bad reporters think the two are the same. > > =================================== > This list is hosted by DevelopMentor® http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com -- ======================================================================= Journalism 101: The difference between news and a press release News tells you what the reporter thinks is true. A press release tells you what a company wants *you* to think is true. Only bad reporters think the two are the same. =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com