yafl_config.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*******************************************************************************
  2. Copyright 2021 anonimous <shkolnick-kun@gmail.com> and contributors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing,
  8. software distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions
  11. and limitations under the License.
  12. ******************************************************************************/
  13. #ifndef YAFL_CONFIG_H
  14. #define YAFL_CONFIG_H
  15. #include <math.h>
  16. #include <stdint.h>
  17. #include <stdio.h>
  18. #define YAFL_DBG(...) fprintf(stderr, __VA_ARGS__)
  19. typedef int32_t yaflInt;
  20. #ifndef YAFL_USE_64_BIT
  21. # define YAFL_USE_64_BIT (0)
  22. #endif/*YAFL_USE_64_BIT*/
  23. #if YAFL_USE_64_BIT
  24. typedef double yaflFloat;
  25. # define YAFL_EPS (1.0e-15)
  26. # define YAFL_SQRT sqrt
  27. # define YAFL_ABS fabs
  28. # define YAFL_ABS fabs
  29. # define YAFL_EXP exp
  30. # define YAFL_LOG log
  31. #else/*YAFL_USE_64_BIT*/
  32. typedef float yaflFloat;
  33. # define YAFL_EPS (1.0e-6)
  34. # define YAFL_SQRT sqrtf
  35. # define YAFL_ABS fabsf
  36. # define YAFL_EXP expf
  37. # define YAFL_LOG logf
  38. #endif/*YAFL_USE_64_BIT*/
  39. #ifdef __GNUC__
  40. # define YAFL_UNLIKELY(x) __builtin_expect((x), 0)
  41. #else
  42. # define YAFL_UNLIKELY(x) (x)
  43. #endif
  44. #endif // YAFL_CONFIG_H