Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix a bug in single->half conversion. #128

Merged
merged 1 commit into from

2 participants

@Frassle
Collaborator

The original C code had if(m & 0x00800000) which is true if the
expresssion does not evaluate to zero. This was inncorretly translated
to the C# code if((m & 0x00800000) == 1) which only evaluates true if
the expression evalaute to 1, which it never does. The correct test is
to test not equal to zero (!= 0).

@Frassle Frassle Fix a bug in single->half conversion.
The original C code had if(m & 0x00800000) which is true if the
expresssion does not evaluate to zero. This was inncorretly translated
to the C# code if((m & 0x00800000) == 1) which only evaluates true if
the expression evalaute to 1, which it never does. The correct test is
to test not equal to zero (!= 0).
5481aa7
@thefiddler thefiddler merged commit aa4e8ef into opentk:develop
@Frassle Frassle deleted the Frassle:half-fix branch
@thefiddler thefiddler added this to the 1.1.3 milestone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 2, 2014
  1. @Frassle

    Fix a bug in single->half conversion.

    Frassle authored
    The original C code had if(m & 0x00800000) which is true if the
    expresssion does not evaluate to zero. This was inncorretly translated
    to the C# code if((m & 0x00800000) == 1) which only evaluates true if
    the expression evalaute to 1, which it never does. The correct test is
    to test not equal to zero (!= 0).
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  Source/OpenTK/Math/Half.cs
View
2  Source/OpenTK/Math/Half.cs
@@ -228,7 +228,7 @@ private UInt16 SingleToHalf(Int32 si32)
mantissa = mantissa + 0x00000fff + ((mantissa >> 13) & 1);
- if ((mantissa & 0x00800000) == 1)
+ if ((mantissa & 0x00800000) != 0)
{
mantissa = 0; // overflow in significand,
exponent += 1; // adjust exponent
Something went wrong with that request. Please try again.