[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Fwd: [PATCH 2/5] d3dx9_36: Implemented ID3DXConstantTable_SetIntArray
From:       Travis Athougies <iammisc () gmail ! com>
Date:       2011-03-30 6:43:03
Message-ID: AANLkTi=FiwX1VHFJuYnq0WRYnNOpQJ7A3-hdr0C147gV () mail ! gmail ! com
[Download RAW message or body]

>> Ints and floats are represented differently and so, if we want to put
>> an integer array into floating point registers, we need to have casts.
>> If you were to simply call SetFloatArray, you would get nonsense
>> values in the floating point registers.
>
> Even using casts will fall foul of the C aliasing rules - which
> mean that the compiler can assume that a read of type will not be
> modified by a write to a different type so can be reorderd (unless
> one of the types is 'char').
>

Exactly. Which is why I am not ever casting int pointers to float
pointers as Rico suggested. Instead I'm looping through the array and
casting each int to a float, which should invoke the machinery
necessary to convert from the bit representation of an int to that of
a float.

> Not only that, but there are systems that will fault is an invalid
> FP bit pattern is loaded into an FP register.
>

If I'm casting ints to floats (and not int pointers to float pointers)
I don't see how this could be an issue.

Travis

-- 
Travis Athougies


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic