ApertureOS
common.h
Go to the documentation of this file.
1 #ifndef _UTILS_COMMON_H_
2 #define _UTILS_COMMON_H_
3 
4 #include "types.h"
5 #include <stdarg.h>
6 
7 #define SET_BIT(x, index) (x | (1 << index))
8 #define CLEAR_BIT(x, index) (x & ~(1 << index))
9 #define TOGGLE_BIT(x, index) (x ^ (1 << index))
10 #define CHECK_BIT(x, index) ((x & (1 << index)) >> index)
11 #define SET_VAL_BIT(number, n, x) ( number ^ ((-x ^ number) & (1 << n)))
12 
13 void* memcpy(void *dest, void *src, size_t size);
14 void* memset(void *ptr, int val, size_t num);
15 void strrev(char *str);
16 size_t strlen(const char *str);
17 char* strcpy ( char * destination, const char * source );
18 int strncmp(const char * s1, const char * s2, size_t n);
19 int vsnprintf ( char * str, const char * format, va_list vl );
20 int sprintf ( char * str, const char * format, ... );
21 char* utoa(uint64_t val, char *ostr, int base);
22 char* itoa(int64_t val, char *ostr, int base);
23 char* strchr(const char *s, int c);
24 char* strrchr(const char *s, int c);
25 
26 UID new_uid();
27 
28 #endif /* end of include guard: _UTILS_COMMON_H_ */
char * itoa(int64_t val, char *ostr, int base)
Definition: sprintf.c:3
UID new_uid()
Definition: common.c:172
uint64_t UID
Definition: types.h:8
int vsnprintf(char *str, const char *format, va_list vl)
Definition: sprintf.c:95
char * utoa(uint64_t val, char *ostr, int base)
Definition: sprintf.c:53
char * strcpy(char *destination, const char *source)
Definition: common.c:149
char * strrchr(const char *s, int c)
Definition: common.c:162
void * memcpy(void *dest, void *src, size_t size)
Definition: common.c:26
int strncmp(const char *s1, const char *s2, size_t n)
Definition: common.c:141
char * strchr(const char *s, int c)
Definition: common.c:154
int sprintf(char *str, const char *format,...)
Definition: sprintf.c:228
size_t strlen(const char *str)
Definition: common.c:131
void * memset(void *ptr, int val, size_t num)
Definition: common.c:63
void strrev(char *str)
Definition: common.c:110