lexLeo
Loading...
Searching...
No Matches
osal.h
1
// src/foundation/osal/include/osal.h
2
3
#include <stdio.h>
4
5
#ifndef LEXLEO_OSAL_H
6
#define LEXLEO_OSAL_H
7
8
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
9
#include <stdalign.h>
10
#include <stddef.h>
11
#define OSAL_ALIGNOF_MAX alignof(max_align_t)
12
#define OSAL_ALIGNED_MAX _Alignas(max_align_t)
13
#else
14
#if defined(_MSC_VER)
15
#define OSAL_ALIGNOF_MAX 16
16
#define OSAL_ALIGNED_MAX __declspec(align(16))
17
#else
18
#define OSAL_ALIGNOF_MAX 16
19
#define OSAL_ALIGNED_MAX __attribute__((aligned(16)))
20
#endif
21
#endif
22
23
// return the smallest multiple of `a` greater than or equal to `x` ;
24
// `a` must be a power of 2 (an alignment value)
25
#ifndef OSAL_ALIGN_UP
26
#define OSAL_ALIGN_UP(x,a) ( ((x) + (a) - 1) & ~((a) - 1) )
27
#endif
28
29
#include <string.h>
30
#if defined(_MSC_VER)
31
#define osal_strdup _strdup
32
#else
33
#define osal_strdup strdup
34
#endif
35
37
void
osal_sleep(
int
ms);
38
39
void
osal_open_in_web_browser(
const
char
*filepath);
40
41
FILE *osal_fmemopen_ro(
const
char
*data,
size_t
len);
42
43
FILE *osal_open_memstream(
char
**out_buf,
size_t
*out_len);
44
45
46
#endif
//LEXLEO_OSAL_H
src
foundation
osal
include
osal.h
Generated by
1.9.8