A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
try again to revalidate this thing... hope it is robust now
[simgrid.git]
/
examples
/
lua
/
kademlia
/
tools.lua
1
function bxor (a,b)
2
local r = 0
3
for i = 0, 31 do
4
local x = a / 2 + b / 2
5
if x ~= math.floor (x) then
6
r = r + 2^i
7
end
8
a = math.floor (a / 2)
9
b = math.floor (b / 2)
10
end
11
return r
12
end
13
14
function index_of(table, o)
15
for i,v in pairs(table) do
16
if v == o then
17
return i;
18
end
19
end
20
return -1
21
end
22
function is_integer(x)
23
return math.floor(x)==x
24
end