Skip to content

Instantly share code, notes, and snippets.

View cppcooper's full-sized avatar

Josh Cooper cppcooper

View GitHub Profile
@cppcooper
cppcooper / twofield_compare_sort.lua
Last active April 14, 2021 20:02
[Lua] pairs functions (sorting iteration)
function spairs3(t, cmp)
-- collect the keys
local keys = {}
for k,v in pairs(job_distributions) do
keys[#keys+1] = k
--print(k)
end
utils.sort_vector(keys, nil, cmp)
@cppcooper
cppcooper / region.h
Last active April 14, 2021 20:03
[C++] bit packing map data
using uint32 = unsigned __int32;
#define regionWidth 4
#define regionHeight 4
class Region_Tile
{
private:
uint32* Region;
uint32 bitmask;
__int8 bit_position;