Rizin
unix-like reverse engineering framework and cli tools
big.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2020 FXTi <zjxiang1998@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 /* Based on https://github.com/kokke/tiny-bignum-c.
5  * Enjoy it --FXTi
6  */
7 
8 #include <rz_util.h>
9 
10 /* Functions for shifting number in-place. */
11 static void _lshift_one_bit(RzNumBig *a);
12 static void _rshift_one_bit(RzNumBig *a);
13 static void _lshift_word(RzNumBig *a, int nwords);
14 static void _rshift_word(RzNumBig *a, int nwords);
15 static void _r_big_zero_out(RzNumBig *n);
16 
19  if (n) {
21  }
22  return n;
23 }
24 
26  free(b);
27 }
28 
31 }
32 
35 }
36 
39 
41  b->sign = (n < 0) ? -1 : 1;
42  RZ_BIG_DTYPE_TMP v = n * b->sign;
43 
44  /* Endianness issue if machine is not little-endian? */
45 #ifdef RZ_BIG_WORD_SIZE
46 #if (RZ_BIG_WORD_SIZE == 1)
47  b->array[0] = (v & 0x000000ff);
48  b->array[1] = (v & 0x0000ff00) >> 8;
49  b->array[2] = (v & 0x00ff0000) >> 16;
50  b->array[3] = (v & 0xff000000) >> 24;
51 #elif (RZ_BIG_WORD_SIZE == 2)
52  b->array[0] = (v & 0x0000ffff);
53  b->array[1] = (v & 0xffff0000) >> 16;
54 #elif (RZ_BIG_WORD_SIZE == 4)
55  b->array[0] = v;
56  RZ_BIG_DTYPE_TMP num_32 = 32;
57  RZ_BIG_DTYPE_TMP tmp = v >> num_32;
58  b->array[1] = tmp;
59 #endif
60 #endif
61 }
62 
65 
67 
68  /* Endianness issue if machine is not little-endian? */
69 #ifdef RZ_BIG_WORD_SIZE
70 #if (RZ_BIG_WORD_SIZE == 1)
71  b->array[0] = (v & 0x000000ff);
72  b->array[1] = (v & 0x0000ff00) >> 8;
73  b->array[2] = (v & 0x00ff0000) >> 16;
74  b->array[3] = (v & 0xff000000) >> 24;
75 #elif (RZ_BIG_WORD_SIZE == 2)
76  b->array[0] = (v & 0x0000ffff);
77  b->array[1] = (v & 0xffff0000) >> 16;
78 #elif (RZ_BIG_WORD_SIZE == 4)
79  b->array[0] = v;
80  RZ_BIG_DTYPE_TMP num_32 = 32;
81  RZ_BIG_DTYPE_TMP tmp = v >> num_32;
82  b->array[1] = tmp;
83 #endif
84 #endif
85 }
86 
89 
90  RZ_BIG_DTYPE_TMP ret = 0;
91 
92  /* Endianness issue if machine is not little-endian? */
93 #if (RZ_BIG_WORD_SIZE == 1)
94  ret += b->array[0];
95  ret += b->array[1] << 8;
96  ret += b->array[2] << 16;
97  ret += b->array[3] << 24;
98 #elif (RZ_BIG_WORD_SIZE == 2)
99  ret += b->array[0];
100  ret += b->array[1] << 16;
101 #elif (RZ_BIG_WORD_SIZE == 4)
102  ret += b->array[1];
103  ret <<= 32;
104  ret += b->array[0];
105 #endif
106 
107  if (b->sign < 0) {
108  return -ret;
109  }
110  return ret;
111 }
112 
113 RZ_API void rz_big_from_hexstr(RzNumBig *n, const char *str) {
116  int nbytes = strlen(str);
117 
119 
120  if (str[0] == '-') {
121  n->sign = -1;
122  str += 1;
123  nbytes -= 1;
124  }
125 
126  if (str[0] == '0' && str[1] == 'x') {
127  str += 2;
128  nbytes -= 2;
129  }
131 
133  int i = nbytes - (2 * RZ_BIG_WORD_SIZE); /* index into string */
134  int j = 0; /* index into array */
135 
136  while (i >= 0) {
137  tmp = 0;
138  sscanf(&str[i], RZ_BIG_SSCANF_FORMAT_STR, &tmp);
139  n->array[j] = tmp;
140  i -= (2 * RZ_BIG_WORD_SIZE); /* step RZ_BIG_WORD_SIZE hex-byte(s) back in the string. */
141  j += 1; /* step one element forward in the array. */
142  }
143 
144  if (-2 * RZ_BIG_WORD_SIZE < i) {
145  char buffer[2 * RZ_BIG_WORD_SIZE];
146  memset(buffer, 0, sizeof(buffer));
147  i += 2 * RZ_BIG_WORD_SIZE - 1;
148  for (; i >= 0; i--) {
149  buffer[i] = str[i];
150  }
151  tmp = 0;
153  n->array[j] = tmp;
154  }
155 }
156 
159 
160  int j = RZ_BIG_ARRAY_SIZE - 1; /* index into array - reading "MSB" first -> big-endian */
161  size_t i = 0; /* index into string representation. */
162  size_t k = 0; /* Leading zero's amount */
163  size_t z, last_z = 2 * RZ_BIG_WORD_SIZE;
164 
165  for (; b->array[j] == 0 && j >= 0; j--) {
166  }
167  if (j == -1) {
168  return "0x0";
169  }
170 
171  size_t size = 3 + 2 * RZ_BIG_WORD_SIZE * (j + 1) + ((b->sign > 0) ? 0 : 1);
172  char *ret_str = calloc(size, sizeof(char));
173  if (!ret_str) {
174  return NULL;
175  }
176 
177  if (b->sign < 0) {
178  ret_str[i++] = '-';
179  }
180  ret_str[i++] = '0';
181  ret_str[i++] = 'x';
182 
184  for (; ret_str[i + k] == '0' && k < 2 * RZ_BIG_WORD_SIZE; k++) {
185  }
186  for (z = k; ret_str[i + z] && z < last_z; z++) {
187  ret_str[i + z - k] = ret_str[i + z];
188  }
189  i += z - k;
190  ret_str[i] = '\x00'; // Truncate string for case(j < 0)
191 
192  for (; j >= 0; j--) {
194  i += 2 * RZ_BIG_WORD_SIZE;
195  }
196 
197  return ret_str;
198 }
199 
203 
204  memcpy(dst, src, sizeof(RzNumBig));
205 }
206 
209  int carry = 0;
210  int i;
211  for (i = 0; i < RZ_BIG_ARRAY_SIZE; i++) {
212  tmp = (RZ_BIG_DTYPE_TMP)a->array[i] + b->array[i] + carry;
213  carry = (tmp > RZ_BIG_MAX_VAL);
214  c->array[i] = (tmp & RZ_BIG_MAX_VAL);
215  }
216 }
217 
219  RZ_BIG_DTYPE_TMP res;
220  RzNumBig *tmp;
221  RZ_BIG_DTYPE_TMP tmp1;
222  RZ_BIG_DTYPE_TMP tmp2;
223  int borrow = 0;
224  int sign = rz_big_cmp(a, b);
225  c->sign = (sign >= 0 ? 1 : -1);
226  if (sign < 0) {
227  tmp = a;
228  a = b;
229  b = tmp;
230  }
231  int i;
232  for (i = 0; i < RZ_BIG_ARRAY_SIZE; i++) {
233  tmp1 = (RZ_BIG_DTYPE_TMP)a->array[i] + (RZ_BIG_MAX_VAL + 1); /* + number_base */
234  tmp2 = (RZ_BIG_DTYPE_TMP)b->array[i] + borrow;
235 
236  res = (tmp1 - tmp2);
237  c->array[i] = (RZ_BIG_DTYPE)(res & RZ_BIG_MAX_VAL); /* "modulo number_base" == "% (number_base - 1)" if nu mber_base is 2^N */
238  borrow = (res <= RZ_BIG_MAX_VAL);
239  }
240 }
241 
246 
247  if (a->sign >= 0 && b->sign >= 0) {
248  rz_big_add_inner(c, a, b);
249  c->sign = 1;
250  return;
251  }
252  if (a->sign >= 0 && b->sign < 0) {
253  rz_big_sub_inner(c, a, b);
254  return;
255  }
256  if (a->sign < 0 && b->sign >= 0) {
257  rz_big_sub_inner(c, b, a);
258  return;
259  }
260  if (a->sign < 0 && b->sign < 0) {
261  rz_big_add_inner(c, a, b);
262  c->sign = -1;
263  return;
264  }
265 }
266 
271 
272  if (a->sign >= 0 && b->sign >= 0) {
273  rz_big_sub_inner(c, a, b);
274  return;
275  }
276  if (a->sign >= 0 && b->sign < 0) {
277  rz_big_add_inner(c, a, b);
278  c->sign = 1;
279  return;
280  }
281  if (a->sign < 0 && b->sign >= 0) {
282  rz_big_add_inner(c, a, b);
283  c->sign = -1;
284  return;
285  }
286  if (a->sign < 0 && b->sign < 0) {
287  rz_big_sub_inner(c, b, a);
288  return;
289  }
290 }
291 
296 
297  RzNumBig *row = rz_big_new();
298  RzNumBig *tmp = rz_big_new();
299  RzNumBig *res = rz_big_new();
300  int i, j;
301 
302  for (i = 0; i < RZ_BIG_ARRAY_SIZE; i++) {
303  _r_big_zero_out(row);
304 
305  for (j = 0; j < RZ_BIG_ARRAY_SIZE; j++) {
306  if (i + j < RZ_BIG_ARRAY_SIZE) {
308  RZ_BIG_DTYPE_TMP intermediate = ((RZ_BIG_DTYPE_TMP)a->array[i] * (RZ_BIG_DTYPE_TMP)b->array[j]);
309  rz_big_from_unsigned(tmp, intermediate);
310  _lshift_word(tmp, i + j);
311  rz_big_add(row, row, tmp);
312  }
313  }
314  rz_big_add(res, row, res);
315  }
316 
317  res->sign = a->sign * b->sign;
318  if (rz_big_is_zero(res)) {
319  res->sign = 1; // For -1 * 0 case
320  }
321  rz_big_assign(c, res);
322 
323  rz_big_free(row);
324  rz_big_free(tmp);
325  rz_big_free(res);
326 }
327 
333 
334  RzNumBig *current = rz_big_new();
335  RzNumBig *denom = rz_big_new();
336  ;
337  RzNumBig *tmp = rz_big_new();
338  int sign = a->sign * b->sign;
339 
340  rz_big_from_int(current, 1); // int current = 1;
341  rz_big_assign(denom, b); // denom = b
342  denom->sign = 1;
343  rz_big_assign(tmp, denom); // tmp = denom = b
344  _lshift_one_bit(tmp); // tmp <= 1
345 
346  while (rz_big_cmp(tmp, a) != 1) { // while (tmp <= a)
347  if ((denom->array[RZ_BIG_ARRAY_SIZE - 1] >> (RZ_BIG_WORD_SIZE * 8 - 1)) == 1) {
348  break; // Reach the max value
349  }
350  _lshift_one_bit(tmp); // tmp <= 1
351  _lshift_one_bit(denom); // denom <= 1
352  _lshift_one_bit(current); // current <= 1
353  }
354 
355  rz_big_assign(tmp, a); // tmp = a
356  tmp->sign = 1;
357  _r_big_zero_out(c); // int answer = 0;
358 
359  while (!rz_big_is_zero(current)) // while (current != 0)
360  {
361  if (rz_big_cmp(tmp, denom) != -1) // if (dividend >= denom)
362  {
363  rz_big_sub(tmp, tmp, denom); // dividend -= denom;
364  rz_big_or(c, current, c); // answer |= current;
365  }
366  _rshift_one_bit(current); // current >>= 1;
367  _rshift_one_bit(denom); // denom >>= 1;
368  } // return answer;
369 
370  c->sign = sign;
371  if (rz_big_is_zero(c)) {
372  c->sign = 1; // For -1 * 0 case
373  }
374  rz_big_free(current);
375  rz_big_free(denom);
376  rz_big_free(tmp);
377 }
378 
380  /*
381  Take divmod and throw away div part
382  */
387 
388  RzNumBig *tmp = rz_big_new();
389 
390  rz_big_divmod(tmp, c, a, b);
391 
392  rz_big_free(tmp);
393 }
394 
396  /*
397  Puts a%b in d
398  and a/b in c
399 
400  mod(a,b) = a - ((a / b) * b)
401 
402  example:
403  mod(8, 3) = 8 - ((8 / 3) * 3) = 2
404  */
409 
410  RzNumBig *tmp = rz_big_new();
411 
412  /* c = (a / b) */
413  rz_big_div(c, a, b);
414 
415  /* tmp = (c * b) */
416  rz_big_mul(tmp, c, b);
417 
418  /* d = a - tmp */
419  rz_big_sub(d, a, tmp);
420 
421  rz_big_free(tmp);
422 }
423 
428  rz_return_if_fail(a->sign > 0);
429  rz_return_if_fail(b->sign > 0);
430 
431  int i;
432  for (i = 0; i < RZ_BIG_ARRAY_SIZE; i++) {
433  c->array[i] = (a->array[i] & b->array[i]);
434  }
435 }
436 
441  rz_return_if_fail(a->sign > 0);
442  rz_return_if_fail(b->sign > 0);
443 
444  int i;
445  for (i = 0; i < RZ_BIG_ARRAY_SIZE; i++) {
446  c->array[i] = (a->array[i] | b->array[i]);
447  }
448 }
449 
454  rz_return_if_fail(a->sign > 0);
455  rz_return_if_fail(b->sign > 0);
456 
457  int i;
458  for (i = 0; i < RZ_BIG_ARRAY_SIZE; i++) {
459  c->array[i] = (a->array[i] ^ b->array[i]);
460  }
461 }
462 
463 RZ_API void rz_big_lshift(RzNumBig *b, RzNumBig *a, size_t nbits) {
466  rz_return_if_fail(a->sign > 0);
467  rz_return_if_fail(b->sign > 0);
468 
469  rz_big_assign(b, a);
470  /* Handle shift in multiples of word-size */
471  const int nbits_pr_word = (RZ_BIG_WORD_SIZE * 8);
472  int nwords = nbits / nbits_pr_word;
473  if (nwords != 0) {
474  _lshift_word(b, nwords);
475  nbits -= (nwords * nbits_pr_word);
476  }
477 
478  if (nbits != 0) {
479  int i;
480  for (i = (RZ_BIG_ARRAY_SIZE - 1); i > 0; i--) {
481  b->array[i] = (b->array[i] << nbits) | (b->array[i - 1] >> ((8 * RZ_BIG_WORD_SIZE) - nbits));
482  }
483  b->array[i] <<= nbits;
484  }
485 }
486 
487 RZ_API void rz_big_rshift(RzNumBig *b, RzNumBig *a, size_t nbits) {
490  rz_return_if_fail(a->sign > 0);
491  rz_return_if_fail(b->sign > 0);
492 
493  rz_big_assign(b, a);
494  /* Handle shift in multiples of word-size */
495  const int nbits_pr_word = (RZ_BIG_WORD_SIZE * 8);
496  int nwords = nbits / nbits_pr_word;
497  if (nwords != 0) {
498  _rshift_word(b, nwords);
499  nbits -= (nwords * nbits_pr_word);
500  }
501 
502  if (nbits != 0) {
503  int i;
504  for (i = 0; i < (RZ_BIG_ARRAY_SIZE - 1); i++) {
505  b->array[i] = (b->array[i] >> nbits) | (b->array[i + 1] << ((8 * RZ_BIG_WORD_SIZE) - nbits));
506  }
507  b->array[i] >>= nbits;
508  }
509 }
510 
514 
515  if (a->sign != b->sign)
516  return a->sign > 0 ? 1 : -1;
517 
518  int i = RZ_BIG_ARRAY_SIZE;
519  do {
520  i -= 1; /* Decrement first, to start with last array element */
521  if (a->array[i] > b->array[i]) {
522  return 1 * a->sign;
523  }
524  if (a->array[i] < b->array[i]) {
525  return -1 * a->sign;
526  }
527  } while (i != 0);
528 
529  return 0;
530 }
531 
534 
535  int i;
536  for (i = 0; i < RZ_BIG_ARRAY_SIZE; i++) {
537  if (a->array[i]) {
538  return 0;
539  }
540  }
541 
542  return 1;
543 }
544 
547  RzNumBig *tmp = rz_big_new();
548 
549  rz_big_from_int(tmp, 1);
550  rz_big_add(a, a, tmp);
551 
552  rz_big_free(tmp);
553 }
554 
557  RzNumBig *tmp = rz_big_new();
558 
559  rz_big_from_int(tmp, 1);
560  rz_big_sub(a, a, tmp);
561 
562  rz_big_free(tmp);
563 }
564 
570 
571  RzNumBig *bcopy = rz_big_new();
572  RzNumBig *acopy = rz_big_new();
573 
574  rz_big_assign(bcopy, b);
575  rz_big_assign(acopy, a);
576  rz_big_mod(acopy, acopy, m);
577  rz_big_from_int(c, 1);
578 
579  while (!rz_big_is_zero(bcopy)) {
580  if (rz_big_to_int(bcopy) % 2 == 1) {
581  rz_big_mul(c, c, acopy);
582  rz_big_mod(c, c, m);
583  }
584  _rshift_one_bit(bcopy);
585  rz_big_mul(acopy, acopy, acopy);
586  rz_big_mod(acopy, acopy, m);
587  }
588 
589  rz_big_free(bcopy);
590  rz_big_free(acopy);
591 }
592 
596 
597  RzNumBig *tmp = rz_big_new();
598  RzNumBig *low = rz_big_new();
599  RzNumBig *high = rz_big_new();
600  RzNumBig *mid = rz_big_new();
601 
602  rz_big_assign(high, a);
603  rz_big_rshift(mid, high, 1);
604  rz_big_inc(mid);
605 
606  while (rz_big_cmp(high, low) > 0) {
607  rz_big_mul(tmp, mid, mid);
608  if (rz_big_cmp(tmp, a) > 0) {
609  rz_big_assign(high, mid);
610  rz_big_dec(high);
611  } else {
612  rz_big_assign(low, mid);
613  }
614  rz_big_sub(mid, high, low);
615  _rshift_one_bit(mid);
616  rz_big_add(mid, mid, low);
617  rz_big_inc(mid);
618  }
619  rz_big_assign(b, low);
620 
621  rz_big_free(tmp);
622  rz_big_free(low);
623  rz_big_free(high);
624  rz_big_free(mid);
625 }
626 
627 /* Private / Static functions. */
628 static void _rshift_word(RzNumBig *a, int nwords) {
629  /* Naive method: */
631  rz_return_if_fail(nwords >= 0);
632 
633  size_t i;
634  if (nwords >= RZ_BIG_ARRAY_SIZE) {
635  for (i = 0; i < RZ_BIG_ARRAY_SIZE; i++) {
636  a->array[i] = 0;
637  }
638  return;
639  }
640 
641  for (i = 0; i < RZ_BIG_ARRAY_SIZE - nwords; i++) {
642  a->array[i] = a->array[i + nwords];
643  }
644  for (; i < RZ_BIG_ARRAY_SIZE; i++) {
645  a->array[i] = 0;
646  }
647 }
648 
649 static void _lshift_word(RzNumBig *a, int nwords) {
651  rz_return_if_fail(nwords >= 0);
652 
653  int i;
654  /* Shift whole words */
655  for (i = (RZ_BIG_ARRAY_SIZE - 1); i >= nwords; i--) {
656  a->array[i] = a->array[i - nwords];
657  }
658  /* Zero pad shifted words. */
659  for (; i >= 0; i--) {
660  a->array[i] = 0;
661  }
662 }
663 
664 static void _lshift_one_bit(RzNumBig *a) {
666 
667  int i;
668  for (i = (RZ_BIG_ARRAY_SIZE - 1); i > 0; i--) {
669  a->array[i] = (a->array[i] << 1) | (a->array[i - 1] >> ((8 * RZ_BIG_WORD_SIZE) - 1));
670  }
671  a->array[0] <<= 1;
672 }
673 
674 static void _rshift_one_bit(RzNumBig *a) {
676 
677  int i;
678  for (i = 0; i < (RZ_BIG_ARRAY_SIZE - 1); i++) {
679  a->array[i] = (a->array[i] >> 1) | (a->array[i + 1] << ((8 * RZ_BIG_WORD_SIZE) - 1));
680  }
681  a->array[RZ_BIG_ARRAY_SIZE - 1] >>= 1;
682 }
683 
684 static void _r_big_zero_out(RzNumBig *a) {
686 
687  size_t i;
688  for (i = 0; i < RZ_BIG_ARRAY_SIZE; i++) {
689  a->array[i] = 0;
690  }
691  a->sign = 1; /* hack to avoid -0 */
692 }
lzma_index ** i
Definition: index.h:629
lzma_index * src
Definition: index.h:567
RZ_API char * rz_big_to_hexstr(RzNumBig *b)
Definition: big.c:157
RZ_API void rz_big_dec(RzNumBig *a)
Definition: big.c:555
static void rz_big_from_unsigned(RzNumBig *b, ut64 v)
Definition: big.c:63
static void _rshift_one_bit(RzNumBig *a)
Definition: big.c:674
RZ_API int rz_big_cmp(RzNumBig *a, RzNumBig *b)
Definition: big.c:511
RZ_API void rz_big_assign(RzNumBig *dst, RzNumBig *src)
Definition: big.c:200
RZ_API void rz_big_and(RzNumBig *c, RzNumBig *a, RzNumBig *b)
Definition: big.c:424
RZ_API void rz_big_rshift(RzNumBig *b, RzNumBig *a, size_t nbits)
Definition: big.c:487
RZ_API void rz_big_from_int(RzNumBig *b, st64 n)
Definition: big.c:37
RZ_API void rz_big_xor(RzNumBig *c, RzNumBig *a, RzNumBig *b)
Definition: big.c:450
RZ_API void rz_big_lshift(RzNumBig *b, RzNumBig *a, size_t nbits)
Definition: big.c:463
RZ_API void rz_big_fini(RzNumBig *b)
Definition: big.c:33
RZ_API void rz_big_add(RzNumBig *c, RzNumBig *a, RzNumBig *b)
Definition: big.c:242
RZ_API void rz_big_from_hexstr(RzNumBig *n, const char *str)
Definition: big.c:113
static void _r_big_zero_out(RzNumBig *n)
Definition: big.c:684
RZ_API void rz_big_divmod(RzNumBig *c, RzNumBig *d, RzNumBig *a, RzNumBig *b)
Definition: big.c:395
RZ_API void rz_big_free(RzNumBig *b)
Definition: big.c:25
static void rz_big_sub_inner(RzNumBig *c, RzNumBig *a, RzNumBig *b)
Definition: big.c:218
static void rz_big_add_inner(RzNumBig *c, RzNumBig *a, RzNumBig *b)
Definition: big.c:207
RZ_API void rz_big_or(RzNumBig *c, RzNumBig *a, RzNumBig *b)
Definition: big.c:437
RZ_API st64 rz_big_to_int(RzNumBig *b)
Definition: big.c:87
RZ_API RzNumBig * rz_big_new(void)
Definition: big.c:17
RZ_API void rz_big_powm(RzNumBig *c, RzNumBig *a, RzNumBig *b, RzNumBig *m)
Definition: big.c:565
RZ_API void rz_big_div(RzNumBig *c, RzNumBig *a, RzNumBig *b)
Definition: big.c:328
RZ_API void rz_big_init(RzNumBig *b)
Definition: big.c:29
RZ_API void rz_big_sub(RzNumBig *c, RzNumBig *a, RzNumBig *b)
Definition: big.c:267
static void _rshift_word(RzNumBig *a, int nwords)
Definition: big.c:628
static void _lshift_one_bit(RzNumBig *a)
Definition: big.c:664
RZ_API void rz_big_mod(RzNumBig *c, RzNumBig *a, RzNumBig *b)
Definition: big.c:379
RZ_API void rz_big_isqrt(RzNumBig *b, RzNumBig *a)
Definition: big.c:593
static void _lshift_word(RzNumBig *a, int nwords)
Definition: big.c:649
RZ_API void rz_big_inc(RzNumBig *a)
Definition: big.c:545
RZ_API void rz_big_mul(RzNumBig *c, RzNumBig *a, RzNumBig *b)
Definition: big.c:292
RZ_API int rz_big_is_zero(RzNumBig *a)
Definition: big.c:532
#define RZ_API
#define NULL
Definition: cris-opc.c:27
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void nbytes
Definition: sflib.h:113
const char * k
Definition: dsignal.c:11
const char * v
Definition: dsignal.c:12
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
voidpf void uLong size
Definition: ioapi.h:138
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void * calloc(size_t number, size_t size)
Definition: malloc.c:102
char * dst
Definition: lz4.h:724
int n
Definition: mipsasm.c:19
#define rz_return_if_fail(expr)
Definition: rz_assert.h:100
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
#define RZ_BIG_DTYPE
Definition: rz_big.h:21
#define RZ_BIG_ARRAY_SIZE
Definition: rz_big.h:19
#define RZ_BIG_WORD_SIZE
Definition: rz_big.h:17
#define RZ_BIG_MAX_VAL
Definition: rz_big.h:26
#define RZ_BIG_DTYPE_TMP
Definition: rz_big.h:22
#define RZ_BIG_FORMAT_STR_LEN
Definition: rz_big.h:24
#define RZ_BIG_SPRINTF_FORMAT_STR
Definition: rz_big.h:23
#define RZ_BIG_SSCANF_FORMAT_STR
Definition: rz_big.h:25
RZ_API int rz_snprintf(char *string, int len, const char *fmt,...) RZ_PRINTF_CHECK(3
#define RZ_NEW(x)
Definition: rz_types.h:285
#define st64
Definition: rz_types_base.h:10
#define d(i)
Definition: sha256.c:44
#define b(i)
Definition: sha256.c:42
#define c(i)
Definition: sha256.c:43
#define a(i)
Definition: sha256.c:41
Definition: buffer.h:15
int sign
Definition: rz_big.h:30
RZ_BIG_DTYPE array[RZ_BIG_ARRAY_SIZE]
Definition: rz_big.h:29
ut64(WINAPI *w32_GetEnabledXStateFeatures)()