lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Irwin <>
Subject Re: Paul: why are we using sbyte?
Date Mon, 07 Apr 2014 20:49:55 GMT
Hey Itamar,

There was existing code that used sbyte, but one of the things I
ran into while porting is that Java was heavily using negative constants
for bytes since their bytes were signed. Also IIRC there were some
greater-than/less-than comparisons that would break if wrapped around to be
between 128 and 255. I tried going down the route of making everything byte
instead of sbyte but kept running into incompatibilities. It was easier --
and arguably more true to the Java code -- to keep it sbyte. Using
Buffer.BlockCopy instead of the Java-equivalent Array.Copy works to
transform the sbyte arrays to byte arrays.

I'm open to any suggestions, and please by all means have at trying to
change it, but it became a royal pain and I got it to work with sbyte so I
didn't pursue the matter further.


On Mon, Apr 7, 2014 at 4:41 PM, Itamar Syn-Hershko <>wrote:

> Hi Paul,
> Please refer to this commit:
> Why have you moved to using sbyte?
> I know this is one of the differences between Java and .NET, but we are on
> .NET and should allow using byte.
> Having Field implementation to expect sbyte[] is almost useless as
> Encoding.GetEncoding(encoding).GetBytes(str); for example returns byte[].
> Can we change it back please so it uses byte everywhere, especially on the
> public facing API?
> --
> Itamar Syn-Hershko
> | @synhershko <>
> Freelance Developer & Consultant
> Author of RavenDB in Action <>


Paul Irwin
Lead Software Engineer

Cell: 863-698-9294

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message