csr_utils.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: GPL 2.0
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License. You should have
  7. * received a copy of the GPL license along with this program; if you
  8. * did not, you can find it at http://www.gnu.org/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is Coreseek.com code.
  16. *
  17. * Copyright (C) 2007-2008. All Rights Reserved.
  18. *
  19. * Author:
  20. * Li monan <li.monan@gmail.com>
  21. *
  22. * ***** END LICENSE BLOCK ***** */
  23. #ifndef _CSR_UTILES_H_
  24. #define _CSR_UTILES_H_
  25. #include "csr_typedefs.h"
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. // helper function
  30. //#undef atoi
  31. /* Convert a string to an int. */
  32. int csr_atoi(const char *nptr);
  33. void csr_perror(const char *s);
  34. void csr_exit_perror(const char *s);
  35. unsigned long currentTimeMillis();
  36. u4 countBitsU4(u4 num);
  37. u2 countBitsU2(u2 num);
  38. u1 countBitsU1(u1 num);
  39. u2 u2_length(const u2 *p);
  40. #ifdef __cplusplus
  41. };
  42. #endif
  43. #endif