| 1 |
// Tencent is pleased to support the open source community by making RapidJSON available. |
| 2 |
// |
| 3 |
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. |
| 4 |
// |
| 5 |
// Licensed under the MIT License (the "License"); you may not use this file except |
| 6 |
// in compliance with the License. You may obtain a copy of the License at |
| 7 |
// |
| 8 |
// http://opensource.org/licenses/MIT |
| 9 |
// |
| 10 |
// Unless required by applicable law or agreed to in writing, software distributed |
| 11 |
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 12 |
// CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 13 |
// specific language governing permissions and limitations under the License. |
| 14 |
|
| 15 |
#include "unittest.h" |
| 16 |
#include "rapidjson/internal/clzll.h" |
| 17 |
|
| 18 |
#ifdef __GNUC__ |
| 19 |
RAPIDJSON_DIAG_PUSH |
| 20 |
#endif |
| 21 |
|
| 22 |
using namespace rapidjson::internal; |
| 23 |
|
| 24 |
TEST(clzll, normal) { |
| 25 |
EXPECT_EQ(clzll(1), 63U); |
| 26 |
EXPECT_EQ(clzll(2), 62U); |
| 27 |
EXPECT_EQ(clzll(12), 60U); |
| 28 |
EXPECT_EQ(clzll(0x0000000080000001UL), 32U); |
| 29 |
EXPECT_EQ(clzll(0x8000000000000001UL), 0U); |
| 30 |
} |
| 31 |
|
| 32 |
#ifdef __GNUC__ |
| 33 |
RAPIDJSON_DIAG_POP |
| 34 |
#endif |