1 // 2 // Copyright (c) 2017 The Khronos Group Inc. 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 #ifndef __ROUNDING_MODE_H__ 17 #define __ROUNDING_MODE_H__ 18 19 #pragma STDC FENV_ACCESS ON 20 21 #include "compat.h" 22 23 #if (defined(_WIN32) && defined(_MSC_VER)) 24 #include "errorHelpers.h" 25 #include "testHarness.h" 26 #endif 27 28 typedef enum 29 { 30 kDefaultRoundingMode = 0, 31 kRoundToNearestEven, 32 kRoundUp, 33 kRoundDown, 34 kRoundTowardZero, 35 36 kRoundingModeCount 37 } RoundingMode; 38 39 typedef enum 40 { 41 kuchar = 0, 42 kchar = 1, 43 kushort = 2, 44 kshort = 3, 45 kuint = 4, 46 kint = 5, 47 kfloat = 6, 48 kdouble = 7, 49 kulong = 8, 50 klong = 9, 51 52 // This goes last 53 kTypeCount 54 } Type; 55 56 extern RoundingMode set_round(RoundingMode r, Type outType); 57 extern RoundingMode get_round(void); 58 extern void *FlushToZero(void); 59 extern void UnFlushToZero(void *p); 60 61 62 #endif /* __ROUNDING_MODE_H__ */ 63