Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.2 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef SND_FIXEDINT_H
  8. #define SND_FIXEDINT_H
  9. #if defined( _WIN32 )
  10. #pragma once
  11. #endif
  12. // fixed point stuff for real-time resampling
  13. #define FIX_BITS 28
  14. #define FIX_SCALE (1 << FIX_BITS)
  15. #define FIX_MASK ((1 << FIX_BITS)-1)
  16. #define FIX_FLOAT(a) ((int)((a) * FIX_SCALE))
  17. #define FIX(a) (((int)(a)) << FIX_BITS)
  18. #define FIX_INTPART(a) (((int)(a)) >> FIX_BITS)
  19. #define FIX_FRACTION(a,b) (FIX(a)/(b))
  20. #define FIX_FRACPART(a) ((a) & FIX_MASK)
  21. #define FIX_TODOUBLE(a) ((double)(a) / (double)FIX_SCALE)
  22. typedef unsigned int fixedint;
  23. #define FIX_BITS14 14
  24. #define FIX_SCALE14 (1 << FIX_BITS14)
  25. #define FIX_MASK14 ((1 << FIX_BITS14)-1)
  26. #define FIX_FLOAT14(a) ((int)((a) * FIX_SCALE14))
  27. #define FIX14(a) (((int)(a)) << FIX_BITS14)
  28. #define FIX_INTPART14(a) (((int)(a)) >> FIX_BITS14)
  29. #define FIX_FRACTION14(a,b) (FIX14(a)/(b))
  30. #define FIX_FRACPART14(a) ((a) & FIX_MASK14)
  31. #define FIX_14TODOUBLE(a) ((double)(a) / (double)FIX_SCALE14)
  32. #define FIX_28TO14(a) ( (int)( ((unsigned int)(a)) >> (FIX_BITS - 14) ) )
  33. #endif // SND_FIXEDINT_H