【新增】上传当前编译过程中的第三方依赖
This commit is contained in:
43
dependence/include/stellar/utils.h
Normal file
43
dependence/include/stellar/utils.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdlib.h> //calloc
|
||||
#include <stddef.h> //NULL
|
||||
|
||||
#define CALLOC(type, number) ((type *)calloc(sizeof(type), number))
|
||||
|
||||
#define REALLOC(type, ptr, number) ((type *)realloc(ptr, (number) * sizeof(type)))
|
||||
|
||||
#define FREE(p) {free(p); p = NULL;}
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef offsetof
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
#endif
|
||||
|
||||
#ifndef container_of
|
||||
#define container_of(ptr, type, member) ({ \
|
||||
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
||||
(type *)( (char *)__mptr - offsetof(type,member) );})
|
||||
#endif
|
||||
|
||||
#ifndef __unused
|
||||
#define __unused __attribute__((__unused__))
|
||||
#endif
|
||||
|
||||
#ifndef likely
|
||||
#define likely(x) __builtin_expect((x),1)
|
||||
#endif /* likely */
|
||||
|
||||
#ifndef unlikely
|
||||
#define unlikely(x) __builtin_expect((x),0)
|
||||
#endif /* unlikely */
|
||||
Reference in New Issue
Block a user