root/branches/cmu/src/libc.h @ 2

Revision 2, 0.8 KB (checked in by cmucam, 5 years ago)

Lets start doing some CMUcam code!

  • Property svn:keywords set to Author Date Id Revision
Line 
1#ifndef __LIBC__
2#define __LIBC__
3
4
5
6#define MIN(a,b) ( ((a)<(b)) ? (a) : (b))
7#define MAX(a,b) ( ((a)>(b)) ? (a) : (b))
8#define ABS(a)   ( (a<0) ? -(a):(a))
9#define SWAP(a,b) tmp = a; a = b; b = tmp;
10
11#define NULL ((void*)0)
12
13// returns the value of sine(x)
14// for x:  0..2pi -> 0..1023
15// return value is between -1024 and 1024
16
17//int sin(int x);
18
19//#define cos(x) (sin((x)+255))
20
21unsigned int rand ();
22extern unsigned int random;
23
24char *itoa (char *str, int num);
25char *itoa_hex (char *str, unsigned int num, int lcase);
26char *sprintf_args (char *str, const char *format, void *args);
27char *sprintf (char *str, const char *format, ...);
28void printf (const char *format, ...);
29
30int strlen (const char *str);
31char *strcpy (char *dest, const char *str);
32int strcmp (const char *str0, const char *str1);
33int atoi (const char *str);
34
35#endif
Note: See TracBrowser for help on using the browser.