/*------------------------------------------------------------------------- * drawElements Base Portability Library * ------------------------------------- * * Copyright 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *//*! * \file * \brief Testing of deInt32 functions. *//*--------------------------------------------------------------------*/ #include "deInt32.h" #include "deRandom.h" #include /* printf() */ DE_BEGIN_EXTERN_C void deInt32_computeLUTs (void) { enum { RCP_LUT_BITS = 8 }; int ndx; printf("enum { RCP_LUT_BITS = %d };\n", RCP_LUT_BITS); printf("static const deUint32 s_rcpLUT[1<= ref-EPS && rcp < ref+EPS); DE_TEST_ASSERT(exp == numBits); } } DE_TEST_ASSERT(deBitMask32(0, 0) == 0); DE_TEST_ASSERT(deBitMask32(8, 0) == 0); DE_TEST_ASSERT(deBitMask32(16, 0) == 0); DE_TEST_ASSERT(deBitMask32(31, 0) == 0); DE_TEST_ASSERT(deBitMask32(32, 0) == 0); DE_TEST_ASSERT(deBitMask32(0, 2) == 3); DE_TEST_ASSERT(deBitMask32(0, 32) == 0xFFFFFFFFu); DE_TEST_ASSERT(deBitMask32(16, 16) == 0xFFFF0000u); DE_TEST_ASSERT(deBitMask32(31, 1) == 0x80000000u); DE_TEST_ASSERT(deBitMask32(8, 4) == 0xF00u); DE_TEST_ASSERT(deUintMaxValue32(1) == 1); DE_TEST_ASSERT(deUintMaxValue32(2) == 3); DE_TEST_ASSERT(deUintMaxValue32(32) == 0xFFFFFFFFu); DE_TEST_ASSERT(deIntMaxValue32(1) == 0); DE_TEST_ASSERT(deIntMaxValue32(2) == 1); DE_TEST_ASSERT(deIntMaxValue32(32) == 0x7FFFFFFF); DE_TEST_ASSERT(deIntMinValue32(1) == -1); DE_TEST_ASSERT(deIntMinValue32(2) == -2); DE_TEST_ASSERT(deIntMinValue32(32) == -0x7FFFFFFF - 1); } DE_END_EXTERN_C