|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
55 #ifdef CLIB_STANDALONE
56 #include <vppinfra/standalone_stdio.h>
109 l0 = i0 + fi->
width[0];
191 uword is_first_digit = 1;
194 for (
i = 0;
i < 2;
i++)
196 if (
c ==
'0' &&
i == 0 && is_first_digit)
201 fi.
width[
i] = va_arg (*va,
int);
206 while (
c >=
'0' &&
c <=
'9')
231 if (
c ==
'l' && *
f ==
'l')
247 .uppercase_digits = 0,
258 s =
format (s,
"**** CLIB unknown format `%%%c' ****",
c);
287 if (
c ==
'x' ||
c ==
'X')
295 number = va_arg (*va,
unsigned long long);
300 number = va_arg (*va,
long);
310 number = va_arg (*va,
int);
325 char *cstring = va_arg (*va,
char *);
333 else if (fi.
width[1] != 0)
336 len = strlen (cstring);
342 vec_add1 (s, cstring[
i] ==
'_' ?
' ' : cstring[
i]);
351 u8 *v = va_arg (*va,
u8 *);
354 if (fi.
width[1] != 0)
374 typedef u8 *(user_func_t) (
u8 * s, va_list * args);
375 user_func_t *u = va_arg (*va, user_func_t *);
382 s =
justify (s, &fi, s_initial_len);
421 return (
u8 *)
"liar liar pants on fire s can't be zero!";
436 return (
u8 *)
"liar liar pants on fire s can't be zero!";
452 ret = fwrite (s,
vec_len (s), 1,
f);
501 ret = write (fd, s,
vec_len (s));
513 u8 digit_buffer[128];
514 u8 *d = digit_buffer +
sizeof (digit_buffer);
533 if (
r < 10 + 26 + 26)
537 else if (
r < 10 + 26)
540 c =
'A' + (
r - 10 - 26);
543 && base <= 10 + 26 && c >=
'a' &&
c <=
'z')
559 vec_add (s, d, digit_buffer +
sizeof (digit_buffer) - d);
565 #define f64_down(f,sign,expon,fraction) \
567 union { u64 u; f64 f; } _f64_down_tmp; \
568 _f64_down_tmp.f = (f); \
569 (sign) = (_f64_down_tmp.u >> 63); \
570 (expon) = ((_f64_down_tmp.u >> 52) & 0x7ff) - 1023; \
571 (fraction) = ((_f64_down_tmp.u << 12) >> 12) | ((u64) 1 << 52); \
584 tmp.u = (
u64) ((sign) != 0) << 63;
591 tmp.u |= (
u64) expon << 52;
593 tmp.u |= fraction & (((
u64) 1 << 52) - 1);
602 static int n_bits = 0;
618 return f64_up (0, base2_expon - n_bits, 0);
627 static f64 t[8] = { 1e+0, 1e+1, 1e+2, 1e+3, 1e+4, 1e+5, 1e+6, 1e+7, };
637 static f64 t[8] = { 1e-0, 1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7, };
652 word expon2, expon10;
657 f64_down (x, sign, expon2, fraction);
661 expon2 * .301029995663981195213738894724493 ;
687 *expon_return = expon10;
710 word sign, expon, n_fraction_done, added_decimal_point;
715 if (n_fraction_digits == ~0)
716 n_fraction_digits = 7;
719 added_decimal_point = 0;
738 return format (s,
"%cNaN", sign ?
'-' :
'+');
742 return format (s,
"%cinfinity", sign ?
'-' :
'+');
747 if ((
word) - expon > (
word) n_fraction_digits
748 && (output_style ==
'f' || (output_style ==
'g')))
754 if (output_style ==
'f'
755 || (output_style ==
'g' && expon > -10 && expon < 10))
761 n_fraction_done =
clib_min (-(expon + 1), n_fraction_digits);
763 decimal_point = -n_fraction_done;
764 added_decimal_point = 1;
767 decimal_point = expon + 1;
793 if (decimal_point <= 0
794 && n_fraction_done + 1 == n_fraction_digits && digit < 9)
802 n_fraction_done += decimal_point < 0;
803 if (decimal_point <= 0 && n_fraction_done >= n_fraction_digits)
806 if (decimal_point == 0 && x != 0)
809 added_decimal_point = 1;
817 if (decimal_point > 0)
823 if (n_fraction_done < n_fraction_digits)
825 if (!added_decimal_point)
830 if (output_style ==
'e')
831 s =
format (s,
"e%wd", expon);
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
static uword pointer_to_uword(const void *p)
const char *const const double number
vnet_hw_if_output_node_runtime_t * r
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
static struct option options[]
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V,...
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void os_puts(u8 *string, uword length, uword is_error)
#define vec_insert(V, N, M)
Insert N vector elements starting at element M, initialize new elements to zero (no header,...