type
stringclasses
5 values
content
stringlengths
9
163k
functions
ssize_t readv(int fd, const struct iovec *iov, int iovcnt) { ssize_t rc; if (inited && fd > ANS_FD_BASE) { fd -= ANS_FD_BASE; ANS_FD_DEBUG("ans fd %d readv with iovcnt %d \n", fd, iovcnt); rc =anssock_readv(fd, iov, iovcnt); return rc; }
functions
ret_t entry_new (entry_t **e) { entry_t *obj; obj = (entry_t *) malloc (sizeof(entry_t)); if (unlikely (obj == NULL)) return ret_nomem; INIT_LIST_HEAD (&obj->entry); hpack_header_field_init (&obj->field); *e = obj; return ret_ok; }
functions
void entry_free (entry_t *e) { hpack_header_field_mrproper (&e->field); free (e); }
functions
ret_t emit (hpack_header_store_t *store, hpack_header_field_t *field) { ret_t ret; entry_t *e; ret = entry_new (&e); if (unlikely (ret != ret_ok)) return ret; hpack_header_field_init (&e->field); hpack_header_field_copy (&e->field, field); chula_list_add_tail (&e->entry, &store->...
functions
ret_t hpack_header_store_emit (hpack_header_store_t *store, hpack_header_field_t *field) { return store->emit (store, field); }
functions
ret_t hpack_header_store_init (hpack_header_store_t *store) { INIT_LIST_HEAD (&store->headers); store->emit = emit; return ret_ok; }
functions
ret_t hpack_header_store_mrproper (hpack_header_store_t *store) { chula_list_t *i, *tmp; list_for_each_safe (i, tmp, &store->headers) { entry_t *e = list_entry(i, entry_t, entry); entry_free(e); }
functions
ret_t hpack_header_store_get_n (hpack_header_store_t *store, uint32_t num, hpack_header_field_t **field) { hpack_header_store_entry_t *i; list_for_each_entry (i, &store->headers, entry) { if (!--num) { *field = &i->field; ...
functions
void hpack_header_store_repr (hpack_header_store_t *store, chula_buffer_t *buf) { hpack_header_store_entry_t *i; uint32_t max_len = 0; chula_buffer_add_va (buf, "hpack_header_store@%x\n", POINTER_TO_INT(store)); /* Find max header name length */ li...
defines
#define PUTCHAR_PROTOTYPE void __io_putchar(void* p, char ch)
defines
#define LED_GPIO_CLK_ENABLE __HAL_RCC_GPIOB_CLK_ENABLE
defines
#define LED_GPIO_PORT GPIOB
defines
#define LED_GPIO_PIN GPIO_PIN_12
functions
void SystemClock_Config(void) { RCC_ClkInitTypeDef clkinitstruct = {0}
functions
void UART_Config(void) { UartHandle.Instance = USART1; UartHandle.Init.BaudRate = 115200; UartHandle.Init.WordLength = UART_WORDLENGTH_8B; UartHandle.Init.StopBits = UART_STOPBITS_1; UartHandle.Init.Parity = UART_PARITY_NONE; UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE; ...
functions
void Error_Handler(void){ while (1) { HAL_GPIO_TogglePin(LED_GPIO_PORT, LED_GPIO_PIN); HAL_Delay(100); }
functions
void assert_failed(uint8_t *file, uint32_t line) { /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* Infinite loop */ while (1) { }
main
int main(void) { HAL_Init(); SystemClock_Config(); LED_GPIO_CLK_ENABLE(); GPIO_InitStruct.Pin = LED_GPIO_PIN; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_LOW; HAL_GPIO_Init(LED_GPIO_PORT, &GPIO_InitStruct); UA...
includes
#include <stdlib.h>
includes
#include <stdio.h>
includes
#include <math.h>
includes
#include <assert.h>
includes
#include <xmmintrin.h>
includes
#include <string.h>
defines
#define VCPLXMUL(ar,ai,br,bi) { v4sf tmp; tmp=VMUL(ar,bi); ar=VMUL(ar,br); ar=VSUB(ar,VMUL(ai,bi)); ai=VMUL(ai,br); ai=VADD(ai,tmp); }
defines
#define VCPLXMULCONJ(ar,ai,br,bi) { v4sf tmp; tmp=VMUL(ar,bi); ar=VMUL(ar,br); ar=VADD(ar,VMUL(ai,bi)); ai=VMUL(ai,br); ai=VSUB(ai,tmp); }
defines
#define SVMUL(f,v) VMUL(LD_PS1(f),v)
defines
#define assertv4(v,f0,f1,f2,f3) assert(v.f[0] == (f0) && v.f[1] == (f1) && v.f[2] == (f2) && v.f[3] == (f3))
defines
#define MALLOC_V4SF_ALIGNMENT 64 // with a 64-byte alignment, we are even aligned on L2 cache lines...
defines
#define cc_ref(a_1,a_2) cc[(a_2-1)*ido + a_1 + 1]
defines
#define ch_ref(a_1,a_3) ch[(a_3-1)*l1*ido + a_1 + 1]
defines
#define cc_ref(a_1,a_2,a_3) cc[((a_3)*l1 + (a_2))*ido + a_1]
defines
#define ch_ref(a_1,a_2,a_3) ch[((a_3)*5 + (a_2))*ido + a_1]
defines
#define cc_ref(a_1,a_2,a_3) cc[((a_3)*5 + (a_2))*ido + a_1]
defines
#define ch_ref(a_1,a_2,a_3) ch[((a_3)*l1 + (a_2))*ido + a_1]
defines
#define pffft_zreorder_nosimd pffft_zreorder
defines
#define pffft_transform_internal_nosimd pffft_transform_internal
defines
#define pffft_zconvolve_accumulate_nosimd pffft_zconvolve_accumulate
structs
struct PFFFT_Setup { int N; int Ncvec; // nb of complex simd vectors (N/4 if PFFFT_COMPLEX, N/8 if PFFFT_REAL) int ifac[15]; pffft_transform_t transform; v4sf *data; // allocated room for twiddle coefs float *e; // points into 'data' , N/4*3 elements float *twiddle; // points into 'data', N/4 e...
functions
v4sf ld_ps1(const float *p) { v4sf v=vec_lde(0,p); return vec_splat(vec_perm(v, v, vec_lvsl(0, p)), 0); }
functions
define INTERLEAVE2(in1, in2, out1, out2) { v4sf tmp__ = vec_mergeh(in1, in2); out2 = vec_mergel(in1, in2); out1 = tmp__; }
functions
define UNINTERLEAVE2(in1, in2, out1, out2) { \ vector unsigned char vperm1 = (vector unsigned char)(0,1,2,3,8,9,10,11,16,17,18,19,24,25,26,27); \ vector unsigned char vperm2 = (vector unsigned char)(4,5,6,7,12,13,14,15,20,21,22,23,28,29,30,31); \ v4sf tmp__ = vec_perm(in1, in2, v...
functions
define VTRANSPOSE4(x0,x1,x2,x3) { \ v4sf y0 = vec_mergeh(x0, x2); \ v4sf y1 = vec_mergel(x0, x2); \ v4sf y2 = vec_mergeh(x1, x3); \ v4sf y3 = vec_mergel(x1, x3); \ x0 = vec_mergeh(y0, y2); \ x1 = vec_mergel(y...
functions
define INTERLEAVE2(in1, in2, out1, out2) { v4sf tmp__ = _mm_unpacklo_ps(in1, in2); out2 = _mm_unpackhi_ps(in1, in2); out1 = tmp__; }
functions
define UNINTERLEAVE2(in1, in2, out1, out2) { v4sf tmp__ = _mm_shuffle_ps(in1, in2, _MM_SHUFFLE(2,0,2,0)); out2 = _mm_shuffle_ps(in1, in2, _MM_SHUFFLE(3,1,3,1)); out1 = tmp__; }
functions
define INTERLEAVE2(in1, in2, out1, out2) { float32x4x2_t tmp__ = vzipq_f32(in1,in2); out1=tmp__.val[0]; out2=tmp__.val[1]; }
functions
define UNINTERLEAVE2(in1, in2, out1, out2) { float32x4x2_t tmp__ = vuzpq_f32(in1,in2); out1=tmp__.val[0]; out2=tmp__.val[1]; }
functions
define VTRANSPOSE4(x0,x1,x2,x3) { \ float32x4x2_t t0_ = vzipq_f32(x0, x2); \ float32x4x2_t t1_ = vzipq_f32(x1, x3); \ float32x4x2_t u0_ = vzipq_f32(t0_.val[0], t1_.val[0]); \ float32x4x2_t u1_ = vzi...
functions
define VTRANSPOSE4(x0,x1,x2,x3) { asm("vtrn.32 %q0, %q1;\n vtrn.32 %q2,%q3\n vswp %f0,%e2\n vswp %f1,%e3" : "+w"(x0), "+w"(x1), "+w"(x2), "+w"(x3)::); }
functions
void validate_pffft_simd() { float f[16] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }
functions
void pffft_aligned_free(void *p) { if (p) free(*((void **) p - 1)); }
functions
int pffft_simd_size() { return SIMD_SZ; }
functions
void radf3_ps(int ido, int l1, const v4sf * RESTRICT cc, v4sf * RESTRICT ch, const float *wa1, const float *wa2) { static const float taur = -0.5f; static const float taui = 0.866025403784439f; int i, k, ic; v4sf ci2, di2, di3, cr2, dr2, dr3, ti2, ti3, tr2, tr3, wr1, wi1, wr2, wi2; for (k...
functions
void radb3_ps(int ido, int l1, const v4sf *RESTRICT cc, v4sf *RESTRICT ch, const float *wa1, const float *wa2) { static const float taur = -0.5f; static const float taui = 0.866025403784439f; static const float taui_2 = 0.866025403784439f*2; int i, k, ic; v4sf ci2, ci3, di2, di3, cr2, cr3...
functions
void radf5_ps(int ido, int l1, const v4sf * RESTRICT cc, v4sf * RESTRICT ch, const float *wa1, const float *wa2, const float *wa3, const float *wa4) { static const float tr11 = .309016994374947f; static const float ti11 = .951056516295154f; static const float tr12 = -.809016994374947f; sta...
functions
void radb5_ps(int ido, int l1, const v4sf *RESTRICT cc, v4sf *RESTRICT ch, const float *wa1, const float *wa2, const float *wa3, const float *wa4) { static const float tr11 = .309016994374947f; static const float ti11 = .951056516295154f; static const float tr12 = -.809016994374947f; static c...
functions
int decompose(int n, int *ifac, const int *ntryh) { int nl = n, nf = 0, i, j = 0; for (j=0; ntryh[j]; ++j) { int ntry = ntryh[j]; while (nl != 1) { int nq = nl / ntry; int nr = nl - ntry * nq; if (nr == 0) { ifac[2+nf++] = ntry; nl = nq; if (ntry == 2 && nf != 1) { ...
functions
void rffti1_ps(int n, float *wa, int *ifac) { static const int ntryh[] = { 4,2,3,5,0 }
functions
void cffti1_ps(int n, float *wa, int *ifac) { static const int ntryh[] = { 5,3,4,2,0 }
functions
void pffft_destroy_setup(PFFFT_Setup *s) { pffft_aligned_free(s->data); free(s); }
functions
void reversed_copy(int N, const v4sf *in, int in_stride, v4sf *out) { v4sf g0, g1; int k; INTERLEAVE2(in[0], in[1], g0, g1); in += in_stride; *--out = VSWAPHL(g0, g1); // [g0l, g0h], [g1l g1h] -> [g1l, g0h] for (k=1; k < N; ++k) { v4sf h0, h1; INTERLEAVE2(in[0], in[1], h0, h1); in += in_stride; ...
functions
void unreversed_copy(int N, const v4sf *in, v4sf *out, int out_stride) { v4sf g0, g1, h0, h1; int k; g0 = g1 = in[0]; ++in; for (k=1; k < N; ++k) { h0 = *in++; h1 = *in++; g1 = VSWAPHL(g1, h0); h0 = VSWAPHL(h0, h1); UNINTERLEAVE2(h0, g1, out[0], out[1]); out += out_stride; g1 = h1; }
functions
void pffft_zreorder(PFFFT_Setup *setup, const float *in, float *out, pffft_direction_t direction) { int k, N = setup->N, Ncvec = setup->Ncvec; const v4sf *vin = (const v4sf*)in; v4sf *vout = (v4sf*)out; assert(in != out); if (setup->transform == PFFFT_REAL) { int k, dk = N/32; if (direction == PFFFT_F...
functions
void pffft_cplx_finalize(int Ncvec, const v4sf *in, v4sf *out, const v4sf *e) { int k, dk = Ncvec/SIMD_SZ; // number of 4x4 matrix blocks v4sf r0, i0, r1, i1, r2, i2, r3, i3; v4sf sr0, dr0, sr1, dr1, si0, di0, si1, di1; assert(in != out); for (k=0; k < dk; ++k) { r0 = in[8*k+0]; i0 = in[8*k+1]; r1...
functions
void pffft_cplx_preprocess(int Ncvec, const v4sf *in, v4sf *out, const v4sf *e) { int k, dk = Ncvec/SIMD_SZ; // number of 4x4 matrix blocks v4sf r0, i0, r1, i1, r2, i2, r3, i3; v4sf sr0, dr0, sr1, dr1, si0, di0, si1, di1; assert(in != out); for (k=0; k < dk; ++k) { r0 = in[8*k+0]; i0 = in[8*k+1]; ...
functions
void pffft_transform_internal(PFFFT_Setup *setup, const float *finput, float *foutput, v4sf *scratch, pffft_direction_t direction, int ordered) { int k, Ncvec = setup->Ncvec; int nf_odd = (setup->ifac[1] & 1); // temporary buffer is allocated on the stack if the scratch pointer is ...
functions
void pffft_zconvolve_accumulate(PFFFT_Setup *s, const float *a, const float *b, float *ab, float scaling) { int Ncvec = s->Ncvec; const v4sf * RESTRICT va = (const v4sf*)a; const v4sf * RESTRICT vb = (const v4sf*)b; v4sf * RESTRICT vab = (v4sf*)ab; #ifdef __arm__ __builtin_prefetch(va); __builtin_prefetch(...
functions
compilers for (i=0; i < Ncvec; i += 2) { v4sf ar, ai, br, bi; ar = va[2*i+0]; ai = va[2*i+1]; br = vb[2*i+0]; bi = vb[2*i+1]; VCPLXMUL(ar, ai, br, bi); vab[2*i+0] = VMADD(ar, vscal, vab[2*i+0]); vab[2*i+1] = VMADD(ai, vscal, vab[2*i+1]); ar = va[2*i+2]; ai = va[2*i+3]; br = vb[2*i+2]; ...
functions
endif if (s->transform == PFFFT_REAL) { ((v4sf_union*)vab)[0].f[0] = abr + ar*br*scaling; ((v4sf_union*)vab)[1].f[0] = abi + ai*bi*scaling; }
functions
void pffft_zreorder_nosimd(PFFFT_Setup *setup, const float *in, float *out, pffft_direction_t direction) { int k, N = setup->N; if (setup->transform == PFFFT_COMPLEX) { for (k=0; k < 2*N; ++k) out[k] = in[k]; return; }
functions
else if (direction == PFFFT_FORWARD) { float x_N = in[N-1]; for (k=N-1; k > 1; --k) out[k] = in[k-1]; out[0] = in[0]; out[1] = x_N; }
functions
void pffft_transform_internal_nosimd(PFFFT_Setup *setup, const float *input, float *output, float *scratch, pffft_direction_t direction, int ordered) { int Ncvec = setup->Ncvec; int nf_odd = (setup->ifac[1] & 1); // temporary buffer is allocated on the stack if the scratch p...
functions
void pffft_zconvolve_accumulate_nosimd(PFFFT_Setup *s, const float *a, const float *b, float *ab, float scaling) { int i, Ncvec = s->Ncvec; if (s->transform == PFFFT_REAL) { // take care of the fftpack ordering ab[0] += a[0]*b[0]*scaling; ab[2*Ncvec-1] += a[2*Ncve...
functions
void pffft_transform(PFFFT_Setup *setup, const float *input, float *output, float *work, pffft_direction_t direction) { pffft_transform_internal(setup, input, output, (v4sf*)work, direction, 0); }
functions
void pffft_transform_ordered(PFFFT_Setup *setup, const float *input, float *output, float *work, pffft_direction_t direction) { pffft_transform_internal(setup, input, output, (v4sf*)work, direction, 1); }
includes
#include <platform.h>
includes
#include <sched.h>
includes
#include <sys/time.h>
includes
#include <sys/resource.h>
includes
#include <sys/mman.h>
includes
#include <pthread_np.h>
includes
#include <sys/cpuset.h>
includes
#include <dlfcn.h>
includes
#include <stdio.h>
defines
#define _GNU_SOURCE
defines
#define LOAD_SYMBOL(sym) \
structs
struct bitmask { unsigned long size; unsigned long *maskp; };
functions
bool ponyint_numa_init() { void* lib = dlopen("libnuma.so.1", RTLD_LAZY); int err = 0; if(lib == NULL) return false; LOAD_SYMBOL(numa_available); LOAD_SYMBOL(numa_num_task_cpus); LOAD_SYMBOL(numa_set_localalloc); LOAD_SYMBOL(numa_node_of_cpu); LOAD_SYMBOL(numa_alloc_onnode); LOAD_SYMBOL(numa_al...
functions
uint32_t ponyint_numa_cores() { if(use_numa) return _numa_num_task_cpus(); return 0; }
functions
uint32_t numa_core_list(cpu_set_t* mask, uint32_t index, uint32_t* list) { uint32_t nodes = _numa_bitmask_weight(*_numa_all_nodes_ptr); struct bitmask* cpu = _numa_allocate_cpumask(); uint32_t node_count = 0; for(uint32_t i = 0; node_count < nodes; i++) { if(!_numa_bitmask_isbitset(*_numa_all_nodes_ptr, ...
functions
uint32_t ponyint_numa_core_list(cpu_set_t* hw_cpus, cpu_set_t* ht_cpus, uint32_t* list) { if(!use_numa) return 0; // Create an ordered list of cpus. Physical CPUs grouped by NUMA node come // first, followed by hyperthreaded CPUs grouped by NUMA node. uint32_t index = 0; index = numa_core_list(hw_cpus...
functions
uint32_t ponyint_numa_node_of_cpu(uint32_t cpu) { if(use_numa) return _numa_node_of_cpu(cpu); return 0; }
functions
bool ponyint_thread_create(pony_thread_id_t* thread, thread_fn start, uint32_t cpu, void* arg) { (void)cpu; #if defined(PLATFORM_IS_WINDOWS) uintptr_t p = _beginthreadex(NULL, 0, start, arg, 0, NULL); if(!p) return false; *thread = (HANDLE)p; #elif defined(PLATFORM_IS_LINUX) pthread_attr_t attr; pt...
functions
bool ponyint_thread_join(pony_thread_id_t thread) { #ifdef PLATFORM_IS_WINDOWS WaitForSingleObject(thread, INFINITE); CloseHandle(thread); #else if(pthread_join(thread, NULL)) return false; #endif return true; }
functions
void ponyint_thread_detach(pony_thread_id_t thread) { #ifndef PLATFORM_IS_WINDOWS pthread_detach(thread); #endif }
functions
pony_thread_id_t ponyint_thread_self() { #ifdef PLATFORM_IS_WINDOWS return GetCurrentThread(); #else return pthread_self(); #endif }
functions
int ponyint_thread_wake(pony_thread_id_t thread, pony_signal_event_t signal) { int ret; #if defined(PLATFORM_IS_WINDOWS) (void) thread; ret = !SetEvent(signal); #elif defined(USE_SCHEDULER_SCALING_PTHREADS) (void) thread; // signal condition variable ret = pthread_cond_signal(signal); #else ret = pthread_...
includes
#include <config.h>
defines
#define LOGMODULE test
functions
int test_invoke (TSS2_SYS_CONTEXT *sys_context) { TSS2_RC rc = TPM2_RC_SUCCESS; TPM2_HANDLE primary_handle = 0; /* session parameters */ /* command session info */ TSS2L_SYS_AUTH_COMMAND sessions_cmd = { .auths = {{ .sessionHandle = TPM2_RS_PW }