type stringclasses 5
values | content stringlengths 9 163k |
|---|---|
functions | int WinMain(){
return main(0, NULL);
} |
main | int main(int argc, char** argv) {
int i = 0;
if(SDL_Init(SDL_INIT_EVERYTHING) != 0) return 0;
win = SDL_CreateWindow("N-Body", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 450, 0);
ren = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED);
SDL_RenderSetLogicalSize(ren, 1600, 900);
SDL_SetRenderDraw... |
functions | int ft_putwchar(wchar_t c)
{
if (c <= 0x7F)
ft_putchar(c);
else if (c <= 0x7FF)
{
ft_putchar((c >> 6) + 0xC0);
ft_putchar((c & 0x3F) + 0x80);
return (2);
} |
functions | else if (c <= 0xFFFF)
{
ft_putchar((c >> 12) + 0xE0);
ft_putchar(((c >> 6) & 0x3F) + 0x80);
ft_putchar((c & 0x3F) + 0x80);
return (3);
} |
functions | else if (c <= 0x10FFFF)
{
ft_putchar((c >> 18) + 0xF0);
ft_putchar(((c >> 12) & 0x3F) + 0x80);
ft_putchar(((c >> 6) & 0x3F) + 0x80);
ft_putchar((c & 0x3F) + 0x80);
return (4);
} |
includes |
#include <stdio.h> |
includes | #include <string.h> |
includes | #include <windows.h> |
includes | #include <time.h> |
includes | #include <windows.h> |
includes | #include <psapi.h> |
includes | #include <stdio.h> |
includes | #include <unistd.h> |
includes | #include <sys/resource.h> |
includes | #include <mach/mach.h> |
includes | #include <kernel/OS.h> |
functions | bool mi_is_in_main(void* stat) {
return ((uint8_t*)stat >= (uint8_t*)&_mi_stats_main
&& (uint8_t*)stat < ((uint8_t*)&_mi_stats_main + sizeof(mi_stats_t)));
} |
functions | void mi_stat_update(mi_stat_count_t* stat, int64_t amount) {
if (amount == 0) return;
if (mi_is_in_main(stat))
{
// add atomically (for abandoned pages)
int64_t current = mi_atomic_addi64_relaxed(&stat->current, amount);
mi_atomic_maxi64_relaxed(&stat->peak, current + amount);
if (amount > 0) {
... |
functions | void _mi_stat_counter_increase(mi_stat_counter_t* stat, size_t amount) {
if (mi_is_in_main(stat)) {
mi_atomic_addi64_relaxed( &stat->count, 1 );
mi_atomic_addi64_relaxed( &stat->total, (int64_t)amount );
} |
functions | void _mi_stat_increase(mi_stat_count_t* stat, size_t amount) {
mi_stat_update(stat, (int64_t)amount);
} |
functions | void _mi_stat_decrease(mi_stat_count_t* stat, size_t amount) {
mi_stat_update(stat, -((int64_t)amount));
} |
functions | void mi_stat_add(mi_stat_count_t* stat, const mi_stat_count_t* src, int64_t unit) {
if (stat==src) return;
if (src->allocated==0 && src->freed==0) return;
mi_atomic_addi64_relaxed( &stat->allocated, src->allocated * unit);
mi_atomic_addi64_relaxed( &stat->current, src->current * unit);
mi_atomic_addi64_relaxe... |
functions | void mi_stat_counter_add(mi_stat_counter_t* stat, const mi_stat_counter_t* src, int64_t unit) {
if (stat==src) return;
mi_atomic_addi64_relaxed( &stat->total, src->total * unit);
mi_atomic_addi64_relaxed( &stat->count, src->count * unit);
} |
functions | void mi_stats_add(mi_stats_t* stats, const mi_stats_t* src) {
if (stats==src) return;
mi_stat_add(&stats->segments, &src->segments,1);
mi_stat_add(&stats->pages, &src->pages,1);
mi_stat_add(&stats->reserved, &src->reserved, 1);
mi_stat_add(&stats->committed, &src->committed, 1);
mi_stat_add(&stats->reset, &... |
functions | void mi_printf_amount(int64_t n, int64_t unit, mi_output_fun* out, void* arg, const char* fmt) {
char buf[32];
int len = 32;
const char* suffix = (unit <= 0 ? " " : "b");
const int64_t base = (unit == 0 ? 1000 : 1024);
if (unit>0) n *= unit;
const int64_t pos = (n < 0 ? -n : n);
if (pos < base) {
sn... |
functions | void mi_print_amount(int64_t n, int64_t unit, mi_output_fun* out, void* arg) {
mi_printf_amount(n,unit,out,arg,NULL);
} |
functions | void mi_print_count(int64_t n, int64_t unit, mi_output_fun* out, void* arg) {
if (unit==1) _mi_fprintf(out, arg, "%11s"," ");
else mi_print_amount(n,0,out,arg);
} |
functions | void mi_stat_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg ) {
_mi_fprintf(out, arg,"%10s:", msg);
if (unit>0) {
mi_print_amount(stat->peak, unit, out, arg);
mi_print_amount(stat->allocated, unit, out, arg);
mi_print_amount(stat->freed, unit, out, arg);
... |
functions | else if (unit<0) {
mi_print_amount(stat->peak, -1, out, arg);
mi_print_amount(stat->allocated, -1, out, arg);
mi_print_amount(stat->freed, -1, out, arg);
mi_print_amount(stat->current, -1, out, arg);
if (unit==-1) {
_mi_fprintf(out, arg, "%22s", "");
} |
functions | void mi_stat_counter_print(const mi_stat_counter_t* stat, const char* msg, mi_output_fun* out, void* arg ) {
_mi_fprintf(out, arg, "%10s:", msg);
mi_print_amount(stat->total, -1, out, arg);
_mi_fprintf(out, arg, "\n");
} |
functions | void mi_stat_counter_print_avg(const mi_stat_counter_t* stat, const char* msg, mi_output_fun* out, void* arg) {
const int64_t avg_tens = (stat->count == 0 ? 0 : (stat->total*10 / stat->count));
const long avg_whole = (long)(avg_tens/10);
const long avg_frac1 = (long)(avg_tens%10);
_mi_fprintf(out, arg, "%10s: ... |
functions | void mi_print_header(mi_output_fun* out, void* arg ) {
_mi_fprintf(out, arg, "%10s: %10s %10s %10s %10s %10s %10s\n", "heap stats", "peak ", "total ", "freed ", "current ", "unit ", "count ");
} |
functions | void mi_stats_print_bins(const mi_stat_count_t* bins, size_t max, const char* fmt, mi_output_fun* out, void* arg) {
bool found = false;
char buf[64];
for (size_t i = 0; i <= max; i++) {
if (bins[i].allocated > 0) {
found = true;
int64_t unit = _mi_bin_size((uint8_t)i);
snprintf(buf, 64, "%s ... |
functions | void mi_buffered_flush(buffered_t* buf) {
buf->buf[buf->used] = 0;
_mi_fputs(buf->out, buf->arg, NULL, buf->buf);
buf->used = 0;
} |
functions | void mi_buffered_out(const char* msg, void* arg) {
buffered_t* buf = (buffered_t*)arg;
if (msg==NULL || buf==NULL) return;
for (const char* src = msg; *src != 0; src++) {
char c = *src;
if (buf->used >= buf->count) mi_buffered_flush(buf);
mi_assert_internal(buf->used < buf->count);
buf->buf[buf->u... |
functions | void mi_stats_merge_from(mi_stats_t* stats) {
if (stats != &_mi_stats_main) {
mi_stats_add(&_mi_stats_main, stats);
memset(stats, 0, sizeof(mi_stats_t));
} |
functions | void _mi_stats_done(mi_stats_t* stats) { // called from `mi_thread_done`
mi_stats_merge_from(stats);
} |
functions | mi_msecs_t mi_to_msecs(LARGE_INTEGER t) {
static LARGE_INTEGER mfreq; // = 0
if (mfreq.QuadPart == 0LL) {
LARGE_INTEGER f;
QueryPerformanceFrequency(&f);
mfreq.QuadPart = f.QuadPart/1000LL;
if (mfreq.QuadPart == 0) mfreq.QuadPart = 1;
} |
functions | mi_msecs_t _mi_clock_now(void) {
LARGE_INTEGER t;
QueryPerformanceCounter(&t);
return mi_to_msecs(t);
} |
functions | mi_msecs_t _mi_clock_now(void) {
struct timespec t;
clock_gettime(CLOCK_REALTIME, &t);
return ((mi_msecs_t)t.tv_sec * 1000) + ((mi_msecs_t)t.tv_nsec / 1000000);
} |
functions | mi_msecs_t _mi_clock_now(void) {
return ((mi_msecs_t)clock() / ((mi_msecs_t)CLOCKS_PER_SEC / 1000));
} |
functions | mi_msecs_t _mi_clock_start(void) {
if (mi_clock_diff == 0.0) {
mi_msecs_t t0 = _mi_clock_now();
mi_clock_diff = _mi_clock_now() - t0;
} |
functions | mi_msecs_t _mi_clock_end(mi_msecs_t start) {
mi_msecs_t end = _mi_clock_now();
return (end - start - mi_clock_diff);
} |
functions | mi_msecs_t filetime_msecs(const FILETIME* ftime) {
ULARGE_INTEGER i;
i.LowPart = ftime->dwLowDateTime;
i.HighPart = ftime->dwHighDateTime;
mi_msecs_t msecs = (i.QuadPart / 10000); // FILETIME is in 100 nano seconds
return msecs;
} |
functions | void mi_stat_process_info(mi_msecs_t* elapsed, mi_msecs_t* utime, mi_msecs_t* stime, size_t* current_rss, size_t* peak_rss, size_t* current_commit, size_t* peak_commit, size_t* page_faults)
{
*elapsed = _mi_clock_end(mi_process_start);
FILETIME ct;
FILETIME ut;
FILETIME st;
FILETIME et;
GetProcessTimes(Get... |
functions | mi_msecs_t timeval_secs(const struct timeval* tv) {
return ((mi_msecs_t)tv->tv_sec * 1000L) + ((mi_msecs_t)tv->tv_usec / 1000L);
} |
functions | void mi_stat_process_info(mi_msecs_t* elapsed, mi_msecs_t* utime, mi_msecs_t* stime, size_t* current_rss, size_t* peak_rss, size_t* current_commit, size_t* peak_commit, size_t* page_faults)
{
*elapsed = _mi_clock_end(mi_process_start);
struct rusage rusage;
getrusage(RUSAGE_SELF, &rusage);
*utime = timeval_secs... |
functions | void mi_stat_process_info(mi_msecs_t* elapsed, mi_msecs_t* utime, mi_msecs_t* stime, size_t* current_rss, size_t* peak_rss, size_t* current_commit, size_t* peak_commit, size_t* page_faults)
{
*elapsed = _mi_clock_end(mi_process_start);
*peak_commit = (size_t)(mi_atomic_loadi64_relaxed((_Atomic(int64_t)*)&_mi_sta... |
includes |
#include <stdlib.h> |
includes | #include <stdio.h> |
includes | #include <pthread.h> |
includes | #include <unistd.h> |
includes | #include <cutils/atomic.h> |
defines |
#define USE_ATOMIC 1 |
defines | #define THREAD_COUNT 10 |
defines | #define ITERATION_COUNT 500000 |
defines | #define HAVE_POSIX_CLOCKS |
functions | int64_t getRelativeTimeNsec(void)
{
#ifdef HAVE_POSIX_CLOCKS
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
return (int64_t) now.tv_sec*1000000000LL + now.tv_nsec;
#else
struct timeval now;
gettimeofday(&now, NULL);
return (int64_t) now.tv_sec*1000000000LL + now.tv_usec * 1000LL;
#e... |
functions | void incr(void)
{
incTest++;
} |
functions | void decr(void)
{
decTest--;
} |
functions | void add(int32_t addVal)
{
addTest += addVal;
} |
functions | int compareAndSwap(int32_t oldVal, int32_t newVal, int32_t* addr)
{
if (*addr == oldVal) {
*addr = newVal;
return 0;
} |
functions | int compareAndSwapWide(int64_t oldVal, int64_t newVal, int64_t* addr)
{
if (*addr == oldVal) {
*addr = newVal;
return 0;
} |
functions | void doAtomicTest(int num)
{
int addVal = (num & 0x01) + 1;
int i;
for (i = 0; i < ITERATION_COUNT; i++) {
if (USE_ATOMIC) {
android_atomic_inc(&incTest);
android_atomic_dec(&decTest);
android_atomic_add(addVal, &addTest);
int val;
do {
... |
functions | int64_t testAtomicSpeedSub(int repeatCount)
{
static int value = 7;
int* valuePtr = &value;
int64_t start, end;
int i;
start = getRelativeTimeNsec();
for (i = repeatCount / 10; i != 0; i--) {
if (USE_ATOMIC) {
// succeed 10x
(void) android_atomic_release_cas(7, ... |
functions | void testAtomicSpeed(void)
{
static const int kIterations = 10;
static const int kRepeatCount = 5 * 1000 * 1000;
static const int kDelay = 50 * 1000;
int64_t results[kIterations];
int i;
for (i = 0; i < kIterations; i++) {
results[i] = testAtomicSpeedSub(kRepeatCount);
usleep(kD... |
functions | bool dvmTestAtomicSpeed(void)
{
pthread_t threads[THREAD_COUNT];
void *(*startRoutine)(void*) = atomicTest;
int64_t startWhen, endWhen;
#if defined(__ARM_ARCH__)
dvmFprintf(stdout, "__ARM_ARCH__ is %d\n", __ARM_ARCH__);
#endif
#if defined(ANDROID_SMP)
dvmFprintf(stdout, "ANDROID_SMP is %d\n", ANDRO... |
includes | #include<stdio.h> |
includes | #include <stdint.h> |
includes | #include <string.h> |
functions | void print_hex_var(const char *label,
const uint8_t *x,
const int len)
{
printf("%s: \n", label);
int i;
for (i = 0; i < len; i++) {
if ((i != 0) && (i % 16 == 0)) {
puts("");
} |
functions | void print_hex(const char* label, const uint8_t *c)
{
print_hex_var(label, c, BLOCKLEN);
} |
functions | void to_be_array(uint8_t* result, const uint64_t src)
{
for (size_t i = 0; i < 8; ++i) {
result[7-i] = (src >> (8*i)) & 0xFF;
} |
functions | void vand(block out, const block a, const block b)
{
for(size_t i = 0; i < BLOCKLEN; ++i) {
out[i] = a[i] & b[i];
} |
functions | void vor(block out, const block a, const block b)
{
for(size_t i = 0; i < BLOCKLEN; ++i) {
out[i] = a[i] | b[i];
} |
functions | void vxor(uint8_t* out, const uint8_t* a, const uint8_t* b,
const size_t len)
{
for(size_t i = 0; i < len; ++i) {
out[i] = a[i] ^ b[i];
} |
functions | void xor_block(block out, const block a, const block b)
{
vxor(out, a, b, BLOCKLEN);
} |
functions | void permute(block x, const block mask)
{
block tmp;
for (size_t i = 0; i < BLOCKLEN; ++i) {
tmp[i] = x[mask[i]];
} |
functions | void permute_tweak(block x)
{
permute(x, H_PERMUTATION);
} |
functions | void gf2_8_double_bytes(block out, const block in)
{
for (int i = 0; i < BLOCKLEN; ++i) {
const uint8_t msb = (in[i] & 0x80) >> 7;
out[i] = (in[i] << 1) ^ (msb * 0x1b);
} |
functions | void tweakey_round(block out, const block in)
{
gf2_8_double_bytes(out, in);
permute_tweak(out);
} |
functions | void deoxys_keysetup(uint8_t* subkeys, const uint8_t key[BLOCKLEN])
{
memcpy(subkeys, key, BLOCKLEN);
for (size_t i = 0; i < DEOXYS_ROUNDS; ++i) {
tweakey_round(subkeys + (i+1)*BLOCKLEN, subkeys + i*BLOCKLEN);
} |
functions | void keysetup(riv_context_t* ctx, const unsigned char key[KEYLEN])
{
AES_KEY aes_enc;
memcpy(ctx->secret_key, key, KEYLEN);
aes_expand_enc_key(ctx->secret_key, KEYLEN_BITS, &aes_enc);
block ctr;
memset(ctr, 0, BLOCKLEN);
aes_encrypt(ctr, ctx->enc_key, &aes_enc);
deoxys_keysetup(ctx->ex... |
functions | void deoxys_encrypt(block output,
const block input,
const block tweak,
const DEOXYS_KEY key)
{
block state;
xor_block(state, input, key);
xor_block(state, state, tweak);
// #ifdef DEBUG
// print_hex("Round 0 state"... |
functions | void cdms(uint8_t out[32], const uint8_t in[32], const DEOXYS_KEY key)
{
const uint8_t* l = in;
const uint8_t* r = in + BLOCKLEN;
uint8_t* x = out;
uint8_t* y = out + BLOCKLEN;
block s;
// output, input, tweak, key
deoxys_encrypt(s, l, r, key); // S <- E_K^{R} |
functions | void set_domain_in_tweak(block x, const block mask)
{
vand(x, x, DOMAIN_MASK);
vor(x, x, mask);
} |
functions | void xor_with_counter(block out,
const block in,
const uint64_t counter)
{
memcpy(out, in, 8);
to_be_array(out+8, counter);
vxor(out+8, out+8, in+8, 8);
} |
functions | void sct_mode(riv_context_t* ctx,
const uint8_t iv[DEOXYS_IVLEN],
const uint8_t* input,
const uint64_t length,
uint8_t* output)
{
uint64_t len = length;
uint8_t* in = (uint8_t*)input;
uint8_t* o... |
functions | void encrypt_final(riv_context_t* ctx,
const unsigned char* plaintext,
const unsigned long long plaintext_length,
const unsigned char* header,
const unsigned long long header_length,
unsigned char* ciphertext,
... |
functions | int constant_time_memcmp(const void* av, const void* bv, size_t len) {
const uint8_t* a = (const uint8_t*) av;
const uint8_t* b = (const uint8_t*) bv;
uint8_t result = 0;
size_t i;
for (i = 0; i < len; i++) {
result |= *a ^ *b;
a++;
b++;
} |
functions | int decrypt_final(riv_context_t* ctx,
const unsigned char* ciphertext,
const unsigned long long ciphertext_length,
const unsigned char* header,
const unsigned long long header_length,
const unsigned char tag[TAGLEN],
... |
includes |
#include <sys/socket.h> |
functions | void
test_mongo_sync_cmd_insert (void)
{
mongo_sync_connection *c;
bson *b1, *b2;
c = test_make_fake_sync_conn (-1, FALSE);
b1 = test_bson_generate_full ();
b2 = test_bson_generate_full ();
ok (mongo_sync_cmd_insert (NULL, "test.ns", b1, b2, NULL) == FALSE,
"mongo_sync_cmd_insert() fails with a NULL... |
defines |
#define APPENDIX_MAGIC 1024 |
defines | #define UNNUMBERED_MAGIC 2048 |
defines | #define SIGN(expr) ((expr) < 0 ? -1 : 1) |
functions | int
set_top_section_level (int level)
{
int i, result = -1;
for (i = 0; section_alist[i].name; i++)
if (strcmp (section_alist[i].name, "top") == 0)
{
result = section_alist[i].level;
section_alist[i].level = level;
break;
} |
functions | int
search_sectioning (char *text)
{
int i;
char *t;
/* ignore the optional command prefix */
if (text[0] == COMMAND_PREFIX)
text++;
for (i = 0; (t = section_alist[i].name); i++)
{
if (strcmp (t, text) == 0)
{
return i;
} |
functions | int
what_section (char *text, char **secname)
{
int index, j;
char *temp;
int return_val;
find_section_command:
for (j = 0; text[j] && cr_or_whitespace (text[j]); j++);
if (text[j] != COMMAND_PREFIX)
return -1;
text = text + j + 1;
/* We skip @c, @comment, and @?index commands. */
if ((strncmp (... |
functions | else if (enum_marker == APPENDIX_MAGIC)
{
char s[2] = { numbers[0] + 64, '\0' } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.