That's basically what I did for the signed bytes.

IMO both options stink.  Leaving them stinks because you have to remember
when it's appropriate to convert and changing them stinks because your you
take up more memory than needed and imply a range of values that is not
correct.

Such is life.

-- Glen

----- Original Message -----
From: "Andrew C. Oliver" <[EMAIL PROTECTED]>
To: "POI Development" <[EMAIL PROTECTED]>
Sent: Sunday, March 24, 2002 11:22 AM
Subject: thought on unsigned short


> Hi all,
>
> I've been thinking about it and I just hate the idea of making all
> shorts ints to handle signing issues.  So how about this.  Add a utility
> function somewhere called ushort that takes in a short and outputs an
> int adjusting the value by reinterpreting the sign as a proper value.
> Yes this will waste an operation but binary operations are not very
> expensive.
>
> Anyhow.  Heres what I think it is roughtly
>
> int retval = myshort;
> if (myshort < 0) {
> retval = (Math.abs(myshort));
> retval = retval |  0x800;
> }
> return retval;
>
> Please correct me if I'm wrong and MARC can you give us the handy dandy
> bit-twiddler version?
>
> Will this work?
>
> We should have the method in a central util class, but then have (for
> convenience) a method called ushort that calls to it in either the
> stylesheet for generating records/types or a superclass.
>
> Thoughts?
>
> -andy
> --
> http://www.superlinksoftware.com
> http://jakarta.apache.org/poi - port of Excel/Word/OLE 2 Compound
> Document
>                             format to java
> http://developer.java.sun.com/developer/bugParade/bugs/4487555.html
> - fix java generics!
> The avalanche has already started. It is too late for the pebbles to
> vote.
> -Ambassador Kosh
>


Reply via email to