type
stringclasses
5 values
content
stringlengths
9
163k
defines
#define round_line(x) (((x) + 31) & ~31)
defines
#define trunc_line(x) ((x) & ~31)
defines
#define SH4_CACHE_WB_U0_P0_P3
defines
#define SH4_CACHE_WB_P1
functions
void sh4_cache_config(void) { int icache_size; int dcache_size; int ways; uint32_t r; /* Determine cache size */ switch (cpu_product) { default: /* FALLTHROUGH */ case CPU_PRODUCT_7750: case CPU_PRODUCT_7750S: case CPU_PRODUCT_7751: #if defined(SH4_CACHE_DISABLE_EMODE) case CPU_PRODUCT_7750R: case...
functions
void cache_sh4_op_line_32(vaddr_t va, vaddr_t base, uint32_t mask, uint32_t bits) { vaddr_t cca; cca = base | (va & mask); _reg_bclr_4(cca, bits); }
functions
void cache_sh4_op_8lines_32(vaddr_t va, vaddr_t base, uint32_t mask, uint32_t bits) { volatile uint32_t *cca = (volatile uint32_t *) (base | (va & mask)); cca[ 0] &= ~bits; cca[ 8] &= ~bits; cca[16] &= ~bits; cca[24] &= ~bits; cca[32] &= ~bits; cca[40] &= ~bits; cca[48] &= ~bits; cca[56] &= ~bits; }
functions
void sh4_icache_sync_all(void) { vaddr_t va = 0; vaddr_t eva = SH4_ICACHE_SIZE; sh4_dcache_wbinv_all(); RUN_P2; while (va < eva) { cache_sh4_op_8lines_32(va, SH4_CCIA, CCIA_ENTRY_MASK, CCIA_V); va += 32 * 8; }
functions
void sh4_icache_sync_range(vaddr_t va, vsize_t sz) { vaddr_t ccia; vaddr_t eva = round_line(va + sz); va = trunc_line(va); sh4_dcache_wbinv_range(va, (eva - va)); RUN_P2; while (va < eva) { /* CCR.IIX has no effect on this entry specification */ ccia = SH4_CCIA | CCIA_A | (va & CCIA_ENTRY_MASK); _reg_writ...
functions
void sh4_icache_sync_range_index(vaddr_t va, vsize_t sz) { vaddr_t eva = round_line(va + sz); va = trunc_line(va); sh4_dcache_wbinv_range_index(va, eva - va); RUN_P2; while ((eva - va) >= (8 * 32)) { cache_sh4_op_8lines_32(va, SH4_CCIA, CCIA_ENTRY_MASK, CCIA_V); va += 32 * 8; }
functions
void sh4_dcache_wbinv_all(void) { vaddr_t va = 0; vaddr_t eva = SH4_DCACHE_SIZE; /* RUN_P2; */ /* called via P2 address if necessary */ while (va < eva) { cache_sh4_op_8lines_32(va, SH4_CCDA, CCDA_ENTRY_MASK, (CCDA_U | CCDA_V)); va += 32 * 8; }
functions
void sh4_dcache_wbinv_range(vaddr_t va, vsize_t sz) { vaddr_t eva = round_line(va + sz); va = trunc_line(va); while (va < eva) { __asm volatile("ocbp @%0" : : "r"(va)); va += 32; }
functions
void sh4_dcache_wbinv_range_index(vaddr_t va, vsize_t sz) { vaddr_t eva = round_line(va + sz); va = trunc_line(va); /* RUN_P2; */ /* called via P2 address if necessary */ while ((eva - va) >= (8 * 32)) { cache_sh4_op_8lines_32(va, SH4_CCDA, CCDA_ENTRY_MASK, (CCDA_U | CCDA_V)); va += 32 * 8; }
functions
void sh4_dcache_inv_range(vaddr_t va, vsize_t sz) { vaddr_t eva = round_line(va + sz); va = trunc_line(va); while (va < eva) { __asm volatile("ocbi @%0" : : "r"(va)); va += 32; }
functions
void sh4_dcache_wb_range(vaddr_t va, vsize_t sz) { vaddr_t eva = round_line(va + sz); va = trunc_line(va); while (va < eva) { __asm volatile("ocbwb @%0" : : "r"(va)); va += 32; }
functions
void cache_sh4_emode_op_line_32(vaddr_t va, vaddr_t base, uint32_t mask, uint32_t bits, uint32_t way_shift) { vaddr_t cca; /* extract entry # */ va &= mask; /* operate for each way */ cca = base | (0 << way_shift) | va; _reg_bclr_4(cca, bits); cca = base | (1 << way_shift) | va; _reg_bclr_4(cca, bits); }
functions
void cache_sh4_emode_op_8lines_32(vaddr_t va, vaddr_t base, uint32_t mask, uint32_t bits, uint32_t way_shift) { volatile uint32_t *cca; /* extract entry # */ va &= mask; /* operate for each way */ cca = (volatile uint32_t *)(base | (0 << way_shift) | va); cca[ 0] &= ~bits; cca[ 8] &= ~bits; cca[16] &= ~bi...
functions
void sh4_emode_icache_sync_all(void) { vaddr_t va = 0; vaddr_t eva = SH4_ICACHE_SIZE; sh4_emode_dcache_wbinv_all(); RUN_P2; while (va < eva) { cache_sh4_emode_op_8lines_32(va, SH4_CCIA, CCIA_ENTRY_MASK, CCIA_V, 13); va += 32 * 8; }
functions
void sh4_emode_icache_sync_range_index(vaddr_t va, vsize_t sz) { vaddr_t eva = round_line(va + sz); va = trunc_line(va); sh4_emode_dcache_wbinv_range_index(va, eva - va); RUN_P2; while ((eva - va) >= (8 * 32)) { cache_sh4_emode_op_8lines_32(va, SH4_CCIA, CCIA_ENTRY_MASK, CCIA_V, 13); va += 32 * 8; }
functions
void sh4_emode_dcache_wbinv_all(void) { vaddr_t va = 0; vaddr_t eva = SH4_DCACHE_SIZE; while (va < eva) { cache_sh4_emode_op_8lines_32(va, SH4_CCDA, CCDA_ENTRY_MASK, (CCDA_U | CCDA_V), 14); va += 32 * 8; }
functions
void sh4_emode_dcache_wbinv_range_index(vaddr_t va, vsize_t sz) { vaddr_t eva = round_line(va + sz); va = trunc_line(va); while ((eva - va) >= (8 * 32)) { cache_sh4_emode_op_8lines_32(va, SH4_CCDA, CCDA_ENTRY_MASK, (CCDA_U | CCDA_V), 14); va += 32 * 8; }
includes
#include <stdio.h>
includes
#include <string.h>
includes
#include <math.h>
includes
#include <float.h>
functions
T rnd(T init) { (void)init; return frand(); }
functions
T mref(T const a[static M*N], unsigned row, unsigned column) { return MREF(a, column, row); }
functions
void mfprint(FILE *fp, T const a[static M*N]) { int i, j, w, colw[N]; memset(colw, 0, sizeof colw); for (j = 0; j < N; j++) { for (i = 0; i < M; i++) { w = snprintf(NULL, 0, PFMTG, mref(a, i, j)); if (w > colw[j]) { colw[j] = w; }
functions
void mprint(T const a[static M*N]) { mfprint(stdout, a); }
functions
T mmax(T const a[static M*N]) { return amax(a, M*N); }
functions
T mmin(T const a[static M*N]) { return amin(a, M*N); }
functions
int mneareqe(T const a[static M*N], T const b[static M*N], T rel_e, T abs_e) { return aneareqe(a, b, M*N, rel_e, abs_e); }
functions
int mneareq(T const a[static M*N], T const b[static M*N]) { return mneareqe(a, b, EQ_REL_EPSILON, EQ_ABS_EPSILON); }
includes
#include <stdlib.h>
includes
#include <errno.h>
includes
#include <string.h>
defines
#define _GNU_SOURCE
functions
Action Action_fromAscii(const char *str) { enum Action action = Action_nomatch; int i; for (i = 0; ActionTypeStr[i] ; i++) { if (strcasestr(str, ActionTypeStr[i])) { action |= 1 << i; }
functions
void Rule_get(struct Rule *r) { r->refcount++; DBG(5, "New reference to Rule %p refcount = %d\n", r, r->refcount); }
functions
void Rule_put(struct Rule **r) { DBG(5, "removing Rule reference to %p refcount = %d id=%d\n", *r, (*r)->refcount, (*r)->rule_id); Object_put((struct Object**)r); }
functions
int Rule_constructor(struct Object *obj) { int i; struct Rule* r = (struct Rule*) obj; DBG(5, "constructor rule size=%d rule=%p\n", (int) sizeof(struct Rule), r); for (i = 0; i < MAX_FITER_GROUPS; i++) { r->filter_groups[i] = FilterList_new(); DBG(5, "new filter list %p for group %d rule = %p \n", r->filte...
functions
int Rule_destructor(struct Object *obj) { struct Rule *rule = (struct Rule*) obj; int i; for (i = 0; i < MAX_FITER_GROUPS; i++) { FilterList_del(&(rule->filter_groups[i])); }
functions
void Rule_setId(struct Rule *r, int id) { r->rule_id = id; }
functions
int Rule_getId(struct Rule *r) { return r->rule_id; }
functions
void Rule_setDiabled(struct Rule *r, bool disabled) { r->disabled = disabled; }
functions
bool Rule_isDiabled(struct Rule *r) { return r->disabled; }
functions
void Rule_setAction(struct Rule *r, enum Action a) { r->action = a; }
functions
void Rule_addFilter(struct Rule *r, unsigned int group, struct Filter *fo) { if (group > MAX_FITER_GROUPS-1) { // invalid ERROR_FATAL("Invalid filter group %d\n", group); }
functions
void Rule_setComment(struct Rule *r, const char *comment) { strncpy(r->comment, comment, RULE_COMMENT_LEN -1); r->comment[RULE_COMMENT_LEN-1] = 0; }
functions
int rule_filter_match_cb(struct Filter *fo, void *data) { struct HttpReq *req = (struct HttpReq *) data; if (!fo || !fo->fo_ops) { ERROR_FATAL("No filter or no ops\n") }
functions
Action Rule_getVerdict(struct Rule *r, struct HttpReq *req) { int i; bool matches; int group_count; for (i = 0 ; i < MAX_FITER_GROUPS; i++) { group_count = FilterList_count(r->filter_groups[i]); DBG(7, "Rule %d Filter group %d has %d filters\n", r->rule_id, i, group_count); /*if group is empty it matche...
functions
bool Rule_containsFilter(struct Rule *r, struct Filter *fo, unsigned int *group) { int i; for (i = 0 ; i < MAX_FITER_GROUPS; i++) { /*if group is empty it matches the ANY '*' case */ if (FilterList_contains(r->filter_groups[i], fo)) { if (group) { *group = i; }
defines
#define TEST_ASSERT(x) UPRV_BLOCK_MACRO_BEGIN { \
defines
#define TEST_SUCCESS(status) UPRV_BLOCK_MACRO_BEGIN { \
functions
void addUTextTest(TestNode** root) { addTest(root, &TestAPI , "tsutil/UTextTest/TestAPI"); }
functions
void TestAPI(void) { UErrorCode status = U_ZERO_ERROR; UBool gFailed = FALSE; (void)gFailed; /* Suppress set but not used warning. */ /* Open */ { UText utLoc = UTEXT_INITIALIZER; const char * cString = "\x61\x62\x63\x64"; UChar uSt...
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <x86intrin.h>
includes
#include <immintrin.h>
includes
#include <sys/time.h>
includes
#include <assert.h>
includes
#include <math.h>
defines
#define __USE_XOPEN2K
defines
#define GETXVALUE(n) AVX_FLOATS diffx##n = AVX_SUBTRACT_FLOATS(AVX_LOAD_FLOATS_UNALIGNED(&localx1[n*NVEC]), m_xpos)
defines
#define GETYVALUE(n) AVX_FLOATS diffy##n = AVX_SUBTRACT_FLOATS(AVX_LOAD_FLOATS_UNALIGNED(&localy1[n*NVEC]), m_ypos)
defines
#define GETZVALUE(n) AVX_FLOATS diffz##n = AVX_SUBTRACT_FLOATS(AVX_LOAD_FLOATS_UNALIGNED(&localz1[n*NVEC]), m_zpos)
defines
#define GETVALUE(n) GETXVALUE(n);GETYVALUE(n);GETZVALUE(n)
defines
#define GETDIST(n) AVX_STORE_FLOATS_TO_MEMORY(&dist[n*NVEC],AVX_ADD_FLOATS(AVX_SQUARE_FLOAT(diffx##n),AVX_ADD_FLOATS(AVX_SQUARE_FLOAT(diffy##n), AVX_SQUARE_FLOAT(diffz##n))))
defines
#define GETDIST(n) AVX_STORE_FLOATS_TO_MEMORY(&dist[n*NVEC],AVX_SQRT_FLOAT(AVX_ADD_FLOATS(AVX_SQUARE_FLOAT(diffx##n),AVX_ADD_FLOATS(AVX_SQUARE_FLOAT(diffy##n), AVX_SQUARE_FLOAT(diffz##n)))))
functions
long check_result(double *dist, const double *pos0, const double *pos1, const int N) { long bad=0; int numbadprinted=0; const double *x0 __attribute__((aligned(ALIGNMENT))) = (const double *) pos0; const double *y0 __attribute__((aligned(ALIGNMENT))) = (const double *) &pos0[N]; const double *z0 __attribute__((...
functions
void naive(const double * restrict x0, const double * restrict y0, const double * restrict z0, const double * restrict x1, const double * restrict y1, const double * restrict z1, const int N0, const int N1, double * restrict d) { for(int i=0;i<N0;i++) { const double xpos __attribute__((aligned(A...
functions
void chunked(const double * restrict x0, const double * restrict y0, const double * restrict z0, const double * restrict x1, const double * restrict y1, const double * restrict z1, const int N0, const int N1, double * restrict d) { const int block_size = 256; for(int i=0;i<N0;i+=block_size) { ...
functions
void compiler_vectorized(const double * restrict x0, const double * restrict y0, const double * restrict z0, const double * restrict x1, const double * restrict y1, const double * restrict z1, const int N0, const int N1, double * restrict d) { for(int i=0;i<N0;i++) { int j; ...
functions
void avx_intrinsics(const double * restrict x0, const double * restrict y0, const double * restrict z0, const double * restrict x1, const double * restrict y1, const double * restrict z1, const int N0, const int N1, double * restrict d) { for(int i=0;i<N0;i++) { const double xpos = x0[...
functions
void avx_intrinsics_unroll(const double * restrict x0, const double * restrict y0, const double * restrict z0, const double * restrict x1, const double * restrict y1, const double * restrict z1, const int N0, const int N1, double * restrict d) { #ifdef SQRT_DIST const int unr...
functions
void avx_intrinsics_kernel(const double * restrict x0, const double * restrict y0, const double * restrict z0, const double * restrict x1, const double * restrict y1, const double * restrict z1, const int N0, const int N1, const int totN1, ...
functions
void avx_intrinsics_chunked(const double * restrict x0, const double * restrict y0, const double * restrict z0, const double * restrict x1, const double * restrict y1, const double * restrict z1, const int N0, const int N1, double * restrict d) { const int block_size = 256; ...
functions
break if(sigma_time/mean_time < convergence_ratio && sum_x >= 300 && iter >= 5) { numdone = numdone_before_iter_loop + max_niterations; break; }
main
int main(int argc, char **argv) { int numpart = 0; if(argc > 1 ) { numpart = atoi(argv[1]); }
includes
#include <winsock2.h>
includes
#include <windows.h>
includes
#include <direct.h>
includes
#include <sys/types.h>
includes
#include <sys/socket.h>
includes
#include <netinet/in.h>
includes
#include <arpa/inet.h>
includes
#include <unistd.h>
defines
#define CLOSE_SOCKET closesocket
defines
#define INVALID_SOCKET -1
defines
#define SOCKET_ERROR -1
defines
#define CLOSE_SOCKET close
defines
#define SOCKET int
defines
#define TCP_PORT 27015
defines
#define LISTEN_BACKLOG 5
defines
#define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2)
functions
void CWE122_Heap_Based_Buffer_Overflow__c_CWE129_listen_socket_14_bad() { int data; /* Initialize data */ data = -1; if(globalFive==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_i...
functions
_WIN32 if (wsaDataInit) { WSACleanup(); }
functions
void goodB2G1() { int data; /* Initialize data */ data = -1; if(globalFive==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; SOCKET listenSocket = INVALID_SO...
functions
_WIN32 if (wsaDataInit) { WSACleanup(); }