Skip to content

Instantly share code, notes, and snippets.

function printf(s, ...)
print(s:format(...))
end
-- public domain
# LuaDist CMake utility library.
# Provides variables and utility functions common to LuaDist CMake builds.
#
# Copyright (C) 2007-2011 LuaDist.
# by David Manura, Peter Drahos
# Redistribution and use of this file is allowed according to the terms of the MIT license.
# For details see the COPYRIGHT file distributed with LuaDist.
# Please note that the package source code is licensed under its own license.
## INSTALL DEFAULTS (Relative to CMAKE_INSTALL_PREFIX)
@davidm
davidm / memoize.lua
Created March 17, 2012 20:35
memoize.lua
--[[
memoize.lua
http://lua-users.org/wiki/FuncTables
http://www.lua.org/pil/17.1.html
Code is public domain.
D.Manura.
--]]
@davidm
davidm / hamming_weight_test.lua
Created March 17, 2012 21:05
hamming weight calculation tests
--[[
Correctness and benchmark tests of various hamming weight implementations.
This is also called "popcount".
See also
http://lua-users.org/wiki/HammingWeight
http://stackoverflow.com/questions/109023/best-algorithm-to-count-the-number-of-set-bits-in-a-32-bit-integer
http://www.dalkescientific.com/writings/diary/archive/2008/07/03/hakmem_and_other_popcounts.html
http://perso.citi.insa-lyon.fr/claurado/ham/overview.pdf
http://chessprogramming.wikispaces.com/Population+Count
David Manura, 2012-03.