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 2802 of file string.c.
2803{
2804 const unsigned char *p1 = ptr1, *p2 = ptr2;
2807
2810
2812
2815
2819
2821}
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 3197 of file string.c.
3198{
3200}
#define memmove(s1, s2, n)
◆ memmove()
Definition at line 3088 of file string.c.
3089{
3090#if defined(__x86_64__) && !defined(__arm64ec__)
3091 return sse2_memmove(
dst,
src,
n);
3092#else
3093 unsigned char *
d =
dst;
3094 const unsigned char *
s =
src;
3095 int sh1;
3096
3097#ifdef __i386__
3099 return sse2_memmove(
dst,
src,
n);
3100#endif
3101
3103
3104 if ((
size_t)
dst - (
size_t)
src >=
n)
3105 {
3106 for (; (
size_t)
d %
sizeof(
size_t) &&
n;
n--) *
d++ = *
s++;
3107
3108 sh1 = 8 * ((
size_t)
s %
sizeof(
size_t));
3109 if (!sh1)
3110 {
3111 while (
n >=
sizeof(
size_t))
3112 {
3113 *(
size_t*)
d = *(
size_t*)
s;
3117 }
3118 }
3119 else if (
n >= 2 *
sizeof(
size_t))
3120 {
3121 int sh2 = 8 *
sizeof(
size_t) - sh1;
3123
3126 do
3127 {
3130 *(
size_t*)
d =
MERGE(
x, sh1,
y, sh2);
3132
3135 *(
size_t*)
d =
MERGE(
y, sh1,
x, sh2);
3137
3139 }
while (
n >= 2 *
sizeof(
size_t));
3141 }
3142 while (
n--) *
d++ = *
s++;
3144 }
3145 else
3146 {
3149
3150 for (; (
size_t)
d %
sizeof(
size_t) &&
n;
n--) *--
d = *--
s;
3151
3152 sh1 = 8 * ((
size_t)
s %
sizeof(
size_t));
3153 if (!sh1)
3154 {
3155 while (
n >=
sizeof(
size_t))
3156 {
3159 *(
size_t*)
d = *(
size_t*)
s;
3161 }
3162 }
3163 else if (
n >= 2 *
sizeof(
size_t))
3164 {
3165 int sh2 = 8 *
sizeof(
size_t) - sh1;
3167
3170 do
3171 {
3175 *(
size_t*)
d =
MERGE(
y, sh1,
x, sh2);
3176
3180 *(
size_t*)
d =
MERGE(
x, sh1,
y, sh2);
3181
3183 }
while (
n >= 2 *
sizeof(
size_t));
3185 }
3186 while (
n--) *--
d = *--
s;
3187 }
3189#endif
3190}
#define MERGE(w1, sh1, w2, sh2)
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
◆ memset()
Definition at line 3230 of file string.c.
3231{
3235
3236 uint64_t v = 0x101010101010101ull * (
unsigned char)
c;
3237 unsigned char *
d = (
unsigned char *)
dst;
3239
3241 {
3242 *(unaligned_ui64 *)(
d + 0) =
v;
3243 *(unaligned_ui64 *)(
d + 8) =
v;
3244 *(unaligned_ui64 *)(
d +
n - 16) =
v;
3245 *(unaligned_ui64 *)(
d +
n - 8) =
v;
3246 if (
n <= 32)
return dst;
3247 *(unaligned_ui64 *)(
d + 16) =
v;
3248 *(unaligned_ui64 *)(
d + 24) =
v;
3249 *(unaligned_ui64 *)(
d +
n - 32) =
v;
3250 *(unaligned_ui64 *)(
d +
n - 24) =
v;
3251 if (
n <= 64)
return dst;
3252
3253 n = (
n -
a) & ~0x1f;
3256 }
3258 {
3259 *(unaligned_ui64 *)
d =
v;
3260 *(unaligned_ui64 *)(
d +
n - 8) =
v;
3262 }
3264 {
3265 *(unaligned_ui32 *)
d =
v;
3266 *(unaligned_ui32 *)(
d +
n - 4) =
v;
3268 }
3270 {
3271 *(unaligned_ui16 *)
d =
v;
3272 *(unaligned_ui16 *)(
d +
n - 2) =
v;
3274 }
3276 {
3279 }
3281}
#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
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().