fake.h 590 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef FAKE_H_
  2. #define FAKE_H_
  3. #include <stdint.h>
  4. #include <stdlib.h>
  5. #include <stdio.h>
  6. #include "int24.h"
  7. typedef Int24 __int24;
  8. typedef UInt24 __uint24;
  9. static inline char *utoa(unsigned int val, char *s, int radix)
  10. {
  11. if (radix == 16) {
  12. sprintf(s, "%X", val);
  13. } else {
  14. fprintf(stderr, "utoa: Unsupported radix %d\n", radix);
  15. abort();
  16. }
  17. return s;
  18. }
  19. static inline char *ltoa(long val, char *s, int radix)
  20. {
  21. if (radix == 10) {
  22. sprintf(s, "%ld", val);
  23. } else {
  24. fprintf(stderr, "ltoa: Unsupported radix %d\n", radix);
  25. abort();
  26. }
  27. return s;
  28. }
  29. #endif /* FAKE_H_ */