Re: Java to C Structure Communication

"Mann, Ivan H" <[email protected]> Thu, 7 Feb 2008 13:58:13 -0600
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <3E47D20FD1918B48AC434AA83B57529601E7D4C3@usplm215.amer.corp.eds.com>
One field is an int - 32 bits - that we are using for file size.  Way
back when, there was not disk as big as 2 Gig, so there was no file that
needed 32 bits to hold the size.  Recently we have had a problem with
files getting larger than 2 Gig, and the fix this year it to use
unsigned numbers to get the extra bit.  As some point we will have to
change to 64 bits because files will go over 4 Gig.

I guess the answer is that we use some creative programming, otherwise
called job security enhancements.

Ivan Mann 

-----Original Message-----
From: Discussion of advanced Java topics.
[mailto:[email protected]] On Behalf Of Jeff Kesselman
Sent: Thursday, February 07, 2008 12:25 PM
To: [email protected]
Subject: Re: [ADVANCED-JAVA] Java to C Structure Communication

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(r)  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(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com