View resumemainthread.c
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 <lua.h> | |
#include <lualib.h> | |
#include <lauxlib.h> | |
#include <stdio.h> | |
const char * source = "print 'A' ; coroutine.yield() ; print 'B'"; | |
int | |
main() { | |
lua_State *L = luaL_newstate(); |
View leetcode1296.c
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 <stdbool.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
struct set { | |
int n; | |
int count; | |
}; | |
static int |
View shortestpath.c
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
// See: https://leetcode.com/problems/shortest-path-in-a-grid-with-obstacles-elimination/ | |
#include <stdio.h> | |
#define MAXN 40 | |
#define MAXSTEP (40*40) | |
struct coord { | |
unsigned char x; | |
unsigned char y; | |
}; |
View period.c
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
// Linux: gcc -Wall -o period period.c -lpthread | |
// Mingw: gcc -Wall -o period.exe period.c | |
#include <stdio.h> | |
#define PERIOD 100 // 100 ms | |
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__) | |
#include <windows.h> |
View prn256.c
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
// 'xoshiro256**' algorithm from lua 5.4 implementation | |
#include "random.h" | |
#include <stdint.h> | |
#include <assert.h> | |
static inline uint64_t * | |
state(struct prn_state *P) { | |
assert(sizeof(*P) == sizeof(uint64_t) * 4); | |
return (uint64_t *)P; | |
} |
View lazymemory.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
#ifndef lazy_memory_h | |
#define lazy_memory_h | |
#include <stdint.h> | |
#include <string.h> | |
#define CacheLine 64 | |
#define WordSize (sizeof(uint64_t) * 8) // 64 (bits) | |
#define AlignN(s, n) (( s + n - 1) / n * n) |
View psystem.cpp
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 "psystem.h" | |
#include <cstddef> | |
#include <cstdio> | |
#include <algorithm> | |
#include <vector> | |
#include "psystem_manager.h" | |
#define REMAP_CACHE 128 | |
namespace { |
View psystem_manager.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
#ifndef particle_system_manager_h | |
#define particle_system_manager_h | |
#define PARTICLE_MAX 0xffff | |
#define PARTICLE_INVALID PARTICLE_MAX | |
#ifndef PARTICLE_COMPONENT | |
#define PARTICLE_COMPONENT 7 | |
#endif |
View utf16.lua
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
local utf16 = {} | |
-- Big Endian | |
function utf16.toutf8(s) | |
local surrogate | |
return (s:gsub("..", function(utf16) | |
local cp = string.unpack(">H", utf16) | |
if (cp & 0xFC00) == 0xD800 then | |
surrogate = cp |
View Localization.cs
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
public void LoadFile(string path) | |
{ | |
try | |
{ | |
string csvText = AssetManager.Get().Resource<string>(path); | |
string[,] array = CSVReader.SplitCsvGrid(csvText); | |
// Fix bug of UCP here | |
for (int i = 2; i < array.GetUpperBound(0); i++) | |
{ | |
for (int j = 1; j < array.GetUpperBound(1); j++) |
NewerOlder