shithub: dav1d

ref: 2989cb3f79e34d561dd2311532b1cb9b182e1170
dir: /src/plan9/plan9.h/

View raw version
#ifndef __plan9_h__
#define __plan9_h__

#define DAV1D_VERSION "no."
#define DAV1D_API_VERSION_MAJOR 9
#define DAV1D_API_VERSION_MINOR 9
#define DAV1D_API_VERSION_PATCH 9

#include <u.h>
#include <libc.h>
#include <stdio.h>
#include </sys/include/thread.h>

#define EINVAL -1
#define ENOMEM -2
#define ENOPROTOOPT -3
#define ERANGE -4
#define EAGAIN -5
#define EIO -6

typedef s8int int8_t;
typedef u8int uint8_t;
typedef s16int int16_t;
typedef u16int uint16_t;
typedef s32int int32_t;
typedef u32int uint32_t;
typedef s64int int64_t;
typedef u64int uint64_t;
typedef uintptr size_t;
typedef intptr ptrdiff_t;
typedef intptr intptr_t;
typedef uintptr uintptr_t;
typedef long atomic_int;
typedef ulong atomic_uint;

#define __func__ "no."
#define __attribute__(a)

#define UINT_MAX 0xffffffffU
#define INT_MAX 0x7fffffff
#define INT_MIN (-INT_MAX-1)
#define INT16_MIN ((int16_t)0x8000)
#define INT16_MAX 0x7fff
#define INT64_MIN ((int64_t)0x8000000000000000LL)
#define SHRT_MAX 0x7fff
#define SHRT_MIN (-SHRT_MAX-1)
#define PRIu64 "llu"

#define memory_order_acquire 0
#define atomic_init(p,v) do { *(p) = (v); } while(0)
#define atomic_store(p,v) do { *(p) = (v); } while(0)
#define atomic_load(p) *(p)
#define atomic_load_explicit(p,o) *(p)
#define atomic_fetch_add(p,i) (*(p) += i)
#define atomic_fetch_sub(p,i) (*(p) -= i)

int __builtin_ctz(unsigned int x);
int __builtin_clz(unsigned int x);
int __builtin_clzll(unsigned long long x);

#define _aligned_malloc(sz, align) mallocalign(sz, align, 0, 0)
#define _aligned_free(p) free(p)

#define llabs(a) ((vlong)(a)<0?-(vlong)(a):(vlong)(a))

#endif