예제 #1
0
        public static unsafe Half SingleToHalf(float single)
        {
            uint value = *((uint *)&single);

            ushort result = (ushort)(baseTable[(value >> 23) & 0x1ff] + ((value & 0x007fffff) >> shiftTable[value >> 23]));

            return(Half.ToHalf(result));
        }
예제 #2
0
 public static Half Abs(Half half)
 {
     return(Half.ToHalf((ushort)(half.value & 0x7fff)));
 }
예제 #3
0
 public static Half Negate(Half half)
 {
     return(Half.ToHalf((ushort)(half.value ^ 0x8000)));
 }