/
usr
/
share
/
systemtap
/
examples
/
stapgames
/
tapset
/
/usr/share/systemtap/examples/stapgames/tapset
mkdir
upload
Name
Size
Mode
Actions
audio.stp
1896
0644
edit
dl
rm
cursor.stp
962
0644
edit
dl
rm
game.stp
660
0644
edit
dl
rm
gmtty.stp
1175
0644
edit
dl
rm
input.stp
2402
0644
edit
dl
rm
Edit:
/usr/share/systemtap/examples/stapgames/tapset/game.stp
(660B)
# Miscellaneous routines for games # Copyright (C) 2008 Masami Hiramatsu <masami.hiramatsu@gmail.com> # # This file is free software and is distributed under the terms of the GNU # General Public License (GPL); either version 2, or (at your option) any # later version. global __GM_rand_seed function game_srand(seed:long) { __GM_rand_seed = seed } function __game_lfsr(val:long) /* pure */ %{ u64 r = THIS->val; r = (r >> 1) ^ ((-(r & 1ULL)) & 0xd800000000000000ULL); THIS->__retvalue = r; %} function game_rand() { return __GM_rand_seed = __game_lfsr(__GM_rand_seed) } function game_urand() { rand = game_rand() return rand<0?-rand:rand }
Save
cmd:
run