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 154 of file stdlib.c.
155{
156#if defined(_MSC_VER) && !defined(__clang__)
159
160#ifdef _WIN64
163 return 0;
164
166#else
171 return 0;
172
174 }
175
177#endif
178
179#else
181 return 0;
182
183 return 64 - __builtin_clzll(
value);
184#endif
185}
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#else
150 return __builtin_ffsll(
value);
151#endif
152}
unsigned char _BitScanForward(unsigned long *_Index, unsigned long _Mask)
Referenced by handle_unary_math().
◆ uacpi_builtin_alloc_zeroed()
Definition at line 188 of file stdlib.c.
189{
191
195
198}
#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_ref_or_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 475 of file stdlib.c.
479{
483 .bytes_written = 0
484 };
485
490
494 .base = 10,
495 };
497
498 if (next_offset)
500
501 if (!next_conversion)
502 break;
503
504 fmt = next_conversion;
507 continue;
508 }
509
510
512
515 case '+':
516 case ' ':
519 continue;
520 case '-':
522 continue;
523 case '0':
525 continue;
526 case '#':
528 continue;
529 default:
530 return -1;
531 }
532 }
533
537 return -1;
538 }
539
542
545 } else {
547 return -1;
548 }
549 }
550
552
556 continue;
557 }
558
562
564 string = "<null>";
565
570 continue;
571 }
572
578 goto write_int;
579 }
580
587 } else {
588 return -1;
589 }
590 goto write_int;
591 }
592
599 } else {
600 return -1;
601 }
602 goto write_int;
603 }
604
612 } else {
613 return -1;
614 }
615 goto write_int;
616 }
617
625 } else {
626 return -1;
627 }
628 goto write_int;
629 }
630
636 } else {
637 return -1;
638 }
639
640 write_int:
644 }
645
647 }
648
651
653 fb_state.
buffer[last_char] =
'\0';
654 }
655
657}
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().