Skip to content

Commit

Permalink
Revert the change at 12:36pm
Browse files Browse the repository at this point in the history
  • Loading branch information
Gene Gleyzer committed Jul 26, 2023
1 parent eeb5262 commit c103367
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Expand Up @@ -126,13 +126,8 @@ public int invokeNativeGet(Frame frame, String sPropName, ObjectHandle hTarget,
{
case "bits":
{
PackedInteger pi = ((IntNHandle) hTarget).m_piValue;
if (f_fSigned && pi.isNegative())
{
// unanswerable question
return overflow(frame);
}
int cBytes = pi.getUnsignedByteSize();
PackedInteger pi = ((IntNHandle) hTarget).m_piValue;
int cBytes = f_fSigned ? pi.getSignedByteSize() : pi.getUnsignedByteSize();
return frame.assignValue(iReturn, xArray.makeBitArrayHandle(
pi.getBigInteger().toByteArray(), cBytes*8, xArray.Mutability.Constant));
}
Expand Down
5 changes: 2 additions & 3 deletions javatools_utils/src/main/java/org/xvm/util/PackedInteger.java
Expand Up @@ -171,9 +171,9 @@ public int getSignedByteSize()
public int getUnsignedByteSize()
{
verifyInitialized();
if (m_fBig ? m_bigint.signum() < 0 : m_lValue < 0)
if (m_fBig && m_bigint.signum() < 0)
{
throw new IllegalStateException("value is signed");
throw new IllegalStateException("negative value");
}

int nBytes = m_fBig
Expand Down Expand Up @@ -322,7 +322,6 @@ public void setBigInteger(BigInteger bigint)
{
// the unsigned value still fits the long
m_lValue = bigint.longValue();
assert m_lValue < 0;
}
else
{
Expand Down

0 comments on commit c103367

Please sign in to comment.