Go to the source code of this file.
|
| #define | uacpi_memcpy memcpy |
| |
| #define | uacpi_memmove memmove |
| |
| #define | uacpi_memset memset |
| |
| #define | uacpi_memcmp memcmp |
| |
| #define | uacpi_free(mem, _) uacpi_kernel_free(mem) |
| |
| #define | uacpi_memzero(ptr, size) uacpi_memset(ptr, 0, size) |
| |
| #define | UACPI_COMPARE(x, y, op) ((x) op (y) ? (x) : (y)) |
| |
| #define | UACPI_MIN(x, y) UACPI_COMPARE(x, y, <) |
| |
| #define | UACPI_MAX(x, y) UACPI_COMPARE(x, y, >) |
| |
| #define | UACPI_ALIGN_UP_MASK(x, mask) (((x) + (mask)) & ~(mask)) |
| |
| #define | UACPI_ALIGN_UP(x, val, type) UACPI_ALIGN_UP_MASK(x, (type)(val) - 1) |
| |
| #define | UACPI_ALIGN_DOWN_MASK(x, mask) ((x) & ~(mask)) |
| |
| #define | UACPI_ALIGN_DOWN(x, val, type) UACPI_ALIGN_DOWN_MASK(x, (type)(val) - 1) |
| |
| #define | UACPI_IS_ALIGNED_MASK(x, mask) (((x) & (mask)) == 0) |
| |
| #define | UACPI_IS_ALIGNED(x, val, type) UACPI_IS_ALIGNED_MASK(x, (type)(val) - 1) |
| |
| #define | UACPI_IS_POWER_OF_TWO(x, type) UACPI_IS_ALIGNED(x, x, type) |
| |
| #define | uacpi_kernel_alloc_zeroed uacpi_builtin_alloc_zeroed |
| |
|
| void * | memcpy (void *dest, const void *src, uacpi_size count) |
| |
| void * | memmove (void *dest, const void *src, uacpi_size count) |
| |
| void * | memset (void *dest, int ch, uacpi_size count) |
| |
| int | memcmp (const void *lhs, const void *rhs, uacpi_size count) |
| |
| uacpi_size | uacpi_strlen (const uacpi_char *str) |
| |
| uacpi_size | uacpi_strnlen (const uacpi_char *str, uacpi_size max) |
| |
| uacpi_i32 | uacpi_strcmp (const uacpi_char *lhs, const uacpi_char *rhs) |
| |
| uacpi_i32 | uacpi_snprintf (uacpi_char *buffer, uacpi_size capacity, const uacpi_char *fmt,...) |
| |
| uacpi_i32 | uacpi_vsnprintf (uacpi_char *buffer, uacpi_size capacity, const uacpi_char *fmt, uacpi_va_list vlist) |
| |
| void | uacpi_memcpy_zerout (void *dst, const void *src, uacpi_size dst_size, uacpi_size src_size) |
| |
| uacpi_u8 | uacpi_bit_scan_forward (uacpi_u64) |
| |
| uacpi_u8 | uacpi_bit_scan_backward (uacpi_u64) |
| |
| void * | uacpi_builtin_alloc_zeroed (uacpi_size size) |
| |
◆ UACPI_ALIGN_DOWN
◆ UACPI_ALIGN_DOWN_MASK
◆ UACPI_ALIGN_UP
◆ UACPI_ALIGN_UP_MASK
◆ UACPI_COMPARE
◆ uacpi_free
◆ UACPI_IS_ALIGNED
◆ UACPI_IS_ALIGNED_MASK
◆ UACPI_IS_POWER_OF_TWO
◆ uacpi_kernel_alloc_zeroed
◆ UACPI_MAX
◆ uacpi_memcmp
◆ uacpi_memcpy
◆ uacpi_memmove
◆ uacpi_memset
◆ uacpi_memzero
◆ UACPI_MIN
◆ memcmp()
Definition at line 2807 of file string.c.
2808{
2809 const unsigned char *p1 = ptr1, *p2 = ptr2;
2812
2815
2817
2820
2824
2826}
static int memcmp_bytes(const void *ptr1, const void *ptr2, size_t n)
static int memcmp_blocks(const void *ptr1, const void *ptr2, size_t size)
int align(int length, int align)
◆ memcpy()
Definition at line 3202 of file string.c.
3203{
3205}
#define memmove(s1, s2, n)
◆ memmove()
Definition at line 3093 of file string.c.
3094{
3095#if defined(__x86_64__) && !defined(__arm64ec__)
3096 return sse2_memmove(
dst,
src,
n);
3097#else
3098 unsigned char *
d =
dst;
3099 const unsigned char *
s =
src;
3100 int sh1;
3101
3102#ifdef __i386__
3104 return sse2_memmove(
dst,
src,
n);
3105#endif
3106
3108
3109 if ((
size_t)
dst - (
size_t)
src >=
n)
3110 {
3111 for (; (
size_t)
d %
sizeof(
size_t) &&
n;
n--) *
d++ = *
s++;
3112
3113 sh1 = 8 * ((
size_t)
s %
sizeof(
size_t));
3114 if (!sh1)
3115 {
3116 while (
n >=
sizeof(
size_t))
3117 {
3118 *(
size_t*)
d = *(
size_t*)
s;
3122 }
3123 }
3124 else if (
n >= 2 *
sizeof(
size_t))
3125 {
3126 int sh2 = 8 *
sizeof(
size_t) - sh1;
3128
3131 do
3132 {
3135 *(
size_t*)
d =
MERGE(
x, sh1,
y, sh2);
3137
3140 *(
size_t*)
d =
MERGE(
y, sh1,
x, sh2);
3142
3144 }
while (
n >= 2 *
sizeof(
size_t));
3146 }
3147 while (
n--) *
d++ = *
s++;
3149 }
3150 else
3151 {
3154
3155 for (; (
size_t)
d %
sizeof(
size_t) &&
n;
n--) *--
d = *--
s;
3156
3157 sh1 = 8 * ((
size_t)
s %
sizeof(
size_t));
3158 if (!sh1)
3159 {
3160 while (
n >=
sizeof(
size_t))
3161 {
3164 *(
size_t*)
d = *(
size_t*)
s;
3166 }
3167 }
3168 else if (
n >= 2 *
sizeof(
size_t))
3169 {
3170 int sh2 = 8 *
sizeof(
size_t) - sh1;
3172
3175 do
3176 {
3180 *(
size_t*)
d =
MERGE(
y, sh1,
x, sh2);
3181
3185 *(
size_t*)
d =
MERGE(
x, sh1,
y, sh2);
3186
3188 }
while (
n >= 2 *
sizeof(
size_t));
3190 }
3191 while (
n--) *--
d = *--
s;
3192 }
3194#endif
3195}
#define MERGE(w1, sh1, w2, sh2)
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
◆ memset()
Definition at line 3235 of file string.c.
3236{
3240
3241 uint64_t v = 0x101010101010101ull * (
unsigned char)
c;
3242 unsigned char *
d = (
unsigned char *)
dst;
3244
3246 {
3247 *(unaligned_ui64 *)(
d + 0) =
v;
3248 *(unaligned_ui64 *)(
d + 8) =
v;
3249 *(unaligned_ui64 *)(
d +
n - 16) =
v;
3250 *(unaligned_ui64 *)(
d +
n - 8) =
v;
3251 if (
n <= 32)
return dst;
3252 *(unaligned_ui64 *)(
d + 16) =
v;
3253 *(unaligned_ui64 *)(
d + 24) =
v;
3254 *(unaligned_ui64 *)(
d +
n - 32) =
v;
3255 *(unaligned_ui64 *)(
d +
n - 24) =
v;
3256 if (
n <= 64)
return dst;
3257
3258 n = (
n -
a) & ~0x1f;
3261 }
3263 {
3264 *(unaligned_ui64 *)
d =
v;
3265 *(unaligned_ui64 *)(
d +
n - 8) =
v;
3267 }
3269 {
3270 *(unaligned_ui32 *)
d =
v;
3271 *(unaligned_ui32 *)(
d +
n - 4) =
v;
3273 }
3275 {
3276 *(unaligned_ui16 *)
d =
v;
3277 *(unaligned_ui16 *)(
d +
n - 2) =
v;
3279 }
3281 {
3284 }
3286}
#define DECLSPEC_ALIGN(x)
static void memset_aligned_32(unsigned char *d, uint64_t v, size_t n)
GLboolean GLboolean GLboolean GLboolean a
◆ uacpi_bit_scan_backward()
Definition at line 166 of file stdlib.c.
167{
168#if defined(_MSC_VER) && !defined(__clang__)
171
172#ifdef _WIN64
175 return 0;
176
178#else
183 return 0;
184
186 }
187
189#endif
190
191#elif defined(__WATCOMC__)
192
195
199 }
200 }
201
202 return 0;
203#else
205 return 0;
206
207 return 64 - __builtin_clzll(
value);
208#endif
209}
__INTRIN_INLINE unsigned char _BitScanReverse64(unsigned long *Index, unsigned long long Mask)
unsigned char _BitScanReverse(unsigned long *_Index, unsigned long _Mask)
Referenced by gas_get_access_bit_width(), and handle_unary_math().
◆ uacpi_bit_scan_forward()
Definition at line 124 of file stdlib.c.
125{
126#if defined(_MSC_VER) && !defined(__clang__)
129
130#ifdef _WIN64
133 return 0;
134
136#else
141 return 0;
142
144 }
145
147#endif
148
149#elif defined(__WATCOMC__)
150
153
157 }
158 }
159
160 return 0;
161#else
162 return __builtin_ffsll(
value);
163#endif
164}
__INTRIN_INLINE unsigned char _BitScanForward64(unsigned long *Index, unsigned long long Mask)
unsigned char _BitScanForward(unsigned long *_Index, unsigned long _Mask)
Referenced by handle_unary_math().
◆ uacpi_builtin_alloc_zeroed()
Definition at line 212 of file stdlib.c.
213{
215
219
222}
#define uacpi_memzero(ptr, size)
void * uacpi_kernel_alloc(uacpi_size size)
◆ uacpi_memcpy_zerout()
Definition at line 112 of file stdlib.c.
114{
116
117 if (bytes_to_copy)
119
120 if (dst_size > bytes_to_copy)
122}
Referenced by buffer_alloc_and_store(), build_table_id(), do_aml_resource_to_native(), do_native_resource_to_aml(), exec_op(), handle_buffer(), handle_deref_of(), handle_special_field(), object_assign_with_implicit_cast(), object_to_integer(), uacpi_dispatch_opregion_io(), uacpi_read_field_unit(), uacpi_write_buffer_field(), and write_buffer_index().
◆ uacpi_snprintf()
◆ uacpi_strcmp()
Definition at line 96 of file stdlib.c.
97{
100
101 while (lhs[
i] && rhs[
i]) {
102 if (lhs[
i] != rhs[
i])
103 return *(cucp)&lhs[
i] - *(cucp)&rhs[
i];
104
106 }
107
108 return *(cucp)&lhs[
i] - *(cucp)&rhs[
i];
109}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Referenced by find_interface_unlocked(), matches_any(), and uacpi_uninstall_interface().
◆ uacpi_strlen()
◆ uacpi_strnlen()
◆ uacpi_vsnprintf()
Definition at line 499 of file stdlib.c.
503{
509
513
517 .base = 10,
518 };
520
521 if (next_offset)
523
524 if (!next_conversion)
525 break;
526
527 fmt = next_conversion;
530 continue;
531 }
532
533
535
538 case '+':
539 case ' ':
542 continue;
543 case '-':
545 continue;
546 case '0':
548 continue;
549 case '#':
551 continue;
552 default:
553 return -1;
554 }
555 }
556
560 return -1;
561 }
562
565
568 } else {
570 return -1;
571 }
572 }
573
575
579 continue;
580 }
581
585
587 string = "<null>";
588
593 continue;
594 }
595
601 goto write_int;
602 }
603
610 } else {
611 return -1;
612 }
613 goto write_int;
614 }
615
622 } else {
623 return -1;
624 }
625 goto write_int;
626 }
627
635 } else {
636 return -1;
637 }
638 goto write_int;
639 }
640
648 } else {
649 return -1;
650 }
651 goto write_int;
652 }
653
659 } else {
660 return -1;
661 }
662
663 write_int:
667 }
668
670 }
671
674
676 fb_state.
buffer[last_char] =
'\0';
677 }
678
680}
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
static uacpi_bool consume(const uacpi_char **string, const uacpi_char *token)
static void write_many(struct fmt_buf_state *fb_state, const uacpi_char *string, uacpi_size count)
static const uacpi_char * find_next_conversion(const uacpi_char *fmt, uacpi_size *offset)
static uacpi_u32 base_from_specifier(uacpi_char specifier)
@ PARSE_NUMBER_MODE_MAYBE
static uacpi_bool consume_one_of(const uacpi_char **string, const uacpi_char *list, uacpi_char *consumed_char)
static void write_one(struct fmt_buf_state *fb_state, uacpi_char c)
static uacpi_bool parse_number(const uacpi_char **fmt, enum parse_number_mode mode, uacpi_u64 *out_value)
static uacpi_bool is_uppercase_specifier(uacpi_char specifier)
static void write_integer(struct fmt_buf_state *fb_state, struct fmt_spec *fm, uacpi_u64 value)
Referenced by uacpi_log(), and uacpi_snprintf().