OLD | NEW |
1 /* Copyright (C) 2007 Jean-Marc Valin | 1 /* Copyright (C) 2007 Jean-Marc Valin |
2 | 2 |
3 File: os_support.h | 3 File: os_support.h |
4 This is the (tiny) OS abstraction layer. Aside from math.h, this is the | 4 This is the (tiny) OS abstraction layer. Aside from math.h, this is the |
5 only place where system headers are allowed. | 5 only place where system headers are allowed. |
6 | 6 |
7 Redistribution and use in source and binary forms, with or without | 7 Redistribution and use in source and binary forms, with or without |
8 modification, are permitted provided that the following conditions are | 8 modification, are permitted provided that the following conditions are |
9 met: | 9 met: |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #endif | 60 #endif |
61 | 61 |
62 /** Opus wrapper for free(). To do your own dynamic allocation, all you need to
do is replace this function and opus_alloc */ | 62 /** Opus wrapper for free(). To do your own dynamic allocation, all you need to
do is replace this function and opus_alloc */ |
63 #ifndef OVERRIDE_OPUS_FREE | 63 #ifndef OVERRIDE_OPUS_FREE |
64 static OPUS_INLINE void opus_free (void *ptr) | 64 static OPUS_INLINE void opus_free (void *ptr) |
65 { | 65 { |
66 free(ptr); | 66 free(ptr); |
67 } | 67 } |
68 #endif | 68 #endif |
69 | 69 |
70 /** Copy n bytes of memory from src to dst. The 0* term provides compile-time ty
pe checking */ | 70 /** Copy n elements from src to dst. The 0* term provides compile-time type chec
king */ |
71 #ifndef OVERRIDE_OPUS_COPY | 71 #ifndef OVERRIDE_OPUS_COPY |
72 #define OPUS_COPY(dst, src, n) (memcpy((dst), (src), (n)*sizeof(*(dst)) + 0*((ds
t)-(src)) )) | 72 #define OPUS_COPY(dst, src, n) (memcpy((dst), (src), (n)*sizeof(*(dst)) + 0*((ds
t)-(src)) )) |
73 #endif | 73 #endif |
74 | 74 |
75 /** Copy n bytes of memory from src to dst, allowing overlapping regions. The 0*
term | 75 /** Copy n elements from src to dst, allowing overlapping regions. The 0* term |
76 provides compile-time type checking */ | 76 provides compile-time type checking */ |
77 #ifndef OVERRIDE_OPUS_MOVE | 77 #ifndef OVERRIDE_OPUS_MOVE |
78 #define OPUS_MOVE(dst, src, n) (memmove((dst), (src), (n)*sizeof(*(dst)) + 0*((d
st)-(src)) )) | 78 #define OPUS_MOVE(dst, src, n) (memmove((dst), (src), (n)*sizeof(*(dst)) + 0*((d
st)-(src)) )) |
79 #endif | 79 #endif |
80 | 80 |
81 /** Set n elements of dst to zero, starting at address s */ | 81 /** Set n elements of dst to zero */ |
82 #ifndef OVERRIDE_OPUS_CLEAR | 82 #ifndef OVERRIDE_OPUS_CLEAR |
83 #define OPUS_CLEAR(dst, n) (memset((dst), 0, (n)*sizeof(*(dst)))) | 83 #define OPUS_CLEAR(dst, n) (memset((dst), 0, (n)*sizeof(*(dst)))) |
84 #endif | 84 #endif |
85 | 85 |
86 /*#ifdef __GNUC__ | 86 /*#ifdef __GNUC__ |
87 #pragma GCC poison printf sprintf | 87 #pragma GCC poison printf sprintf |
88 #pragma GCC poison malloc free realloc calloc | 88 #pragma GCC poison malloc free realloc calloc |
89 #endif*/ | 89 #endif*/ |
90 | 90 |
91 #endif /* OS_SUPPORT_H */ | 91 #endif /* OS_SUPPORT_H */ |
92 | 92 |
OLD | NEW |