This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#define L1_CACHE_SZ (32 * 1024) | |
#define L2_CACHE_SZ (1024 * 1024) | |
#define TESTOBJ sx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <iostream> | |
#include <chrono> | |
#include <vector> | |
typedef struct x { | |
int a; | |
float b; | |
} sx; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <unistd.h> | |
# define LIKELY(x) __builtin_expect(!!(x), 1) | |
# define UNLIKELY(x) __builtin_expect(!!(x), 0) | |
static char encode_table[64] = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdatomic.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <pthread.h> | |
#include <linux/futex.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ucontext.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define handle_error(msg) \ | |
do { perror(msg); exit(EXIT_FAILURE); } while (0) | |
#define CO_STACK_SIZE 2048 | |
typedef struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void remove_bad_utf8 (uint8_t *src, size_t srclen) | |
{ | |
uint8_t *dst = src; | |
uint8_t *srcend = src + srclen; | |
while (src < srcend) { | |
// 0xxxxxxx | |
if ((src[0] & 0x80) == 0x00) { | |
if (src[0] < 0x20 || src[0] == 0x7F) { | |
/* printf("not printable one-byte char...%02X\n", src[0]); */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <setjmp.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define COROUTINE_START int r = setjmp(current->context);\ | |
switch (r) {\ | |
case 0: | |
#define COROUTINE_PREEMPT if (current->iter % 500 == 0) {\ | |
longjmp(m, 1);\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bits = 2048 | |
const { publicKey } = crypto.generateKeyPairSync('rsa', { | |
modulusLength: bits, | |
publicKeyEncoding: { | |
type: 'pkcs1', | |
format: 'pem' | |
} | |
}) | |
const test = (len) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! myspacevim#before() abort | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" BASICS | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
syntax on | |
set updatetime=1000 | |
"for performance issue | |
set re=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#============================================================================= | |
# dark_powered.toml --- dark powered configuration example for SpaceVim | |
# Copyright (c) 2016-2020 Wang Shidong & Contributors | |
# Author: Wang Shidong < wsdjeg at 163.com > | |
# URL: https://spacevim.org | |
# License: GPLv3 | |
#============================================================================= | |
# All SpaceVim option below [option] section | |
[options] |