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; | |
} |
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) |
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 { |
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 |
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 |
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++) |
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
--[[ | |
370104 words from https://github.com/dwyl/english-words/blob/master/words_alpha.txt | |
3/4 5/8 7/8 9/16 11/16 13/16 15/32 17/32 19/32 21/32 | |
(h<<5) + (h>>2) + x (3)84874 (4)81670 (4)113326 (4)80336 (2)96169 (5)111520 (4)125243 (3)79309 (4)87762 (5)95643 | |
(h<<4) + (h>>3) + x (2)84819 (1)81351 (3)113283 (5)80439 (3)96264 (2)111197 (3)125200 (4)79486 (2)87582 (2)95430 | |
(h<<5) - (h>>2) + x (1)84464 (2)81428 (2)113108 (2)80201 (4)96464 (4)111469 (1)125052 (2)79222 (3)87666 (3)95466 | |
(h<<4) - (h>>3) + x (4)85050 (3)81587 (1)113084 (1)80112 (1)96131 (1)111134 (2)125185 (1)79163 (1)87361 (1)95239 | |
((h + x) * 0xAAAB) >> 3 (5)85143 |
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
/* | |
Only for lua 5.3 | |
You can use lua_changeseed(L, seed) to change a seed for a lua VM. | |
lua_State *L = luaL_newstate(); | |
lua_changeseed(L, myseed); | |
*/ | |
#include "lstate.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
local skynet = require "skynet" | |
local socket = require "skynet.socket" | |
local db_path = assert(skynet.getenv "cache_db") .. "/" | |
local mode = (...) or "main" | |
local function tohex(c) | |
return string.format("%02x", c:byte()) | |
end |
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 idl = require "idl" | |
do | |
local doxygen = require "doxygen" | |
local source = doxygen.load "bgfx.idl" | |
local f = assert(load(source, "bgfx.idl" , "t", idl)) | |
f() | |
local codegen = require "codegen" | |
codegen.nameconversion(idl.types, idl.funcs) |