2 * Copyright 2012 Google, Inc. All Rights Reserved.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 * Google Author(s): Behdad Esfahbod, Maysum Panju
19 #ifndef GLYPHY_COMMON_HH
20 #define GLYPHY_COMMON_HH
31 #ifndef GLYPHY_EPSILON
32 # define GLYPHY_EPSILON 1e-5
34 #ifndef GLYPHY_INFINITY
35 # define GLYPHY_INFINITY INFINITY
42 return fabs (v) < 2 * GLYPHY_EPSILON;
46 #define GLYPHY_MAX_D .5
49 #define ARRAY_LENGTH(__array) ((signed int) (sizeof (__array) / sizeof (__array[0])))
51 #define _ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1]
52 #define _ASSERT_STATIC0(_line, _cond) _ASSERT_STATIC1 (_line, (_cond))
53 #define ASSERT_STATIC(_cond) _ASSERT_STATIC0 (__LINE__, (_cond))
56 #define log2(x) (log(x) / log(2.0))
59 #endif /* GLYPHY_COMMON_HH */