Skip to content

Instantly share code, notes, and snippets.

View yashi's full-sized avatar

Yasushi SHOJI yashi

View GitHub Profile
@yashi
yashi / gist:2430822
Created April 20, 2012 18:16
define SIZEOF_ST_INDEX_T
diff --git a/src/st.c b/src/st.c
index c4bbc70..49ef31b 100644
--- a/src/st.c
+++ b/src/st.c
@@ -963,6 +963,8 @@ strhash(st_data_t arg)
#define MURMUR 2
#endif
+#define SIZEOF_ST_INDEX_T __WORDSIZE
+
@yashi
yashi / gist:2433311
Created April 21, 2012 02:21
mruby ritevm instruction format
/* instructions OP:A:B:C = 7:9:9:7 (32 bits) */
/* OP:A:Bx = 7:9:16 */
/* OP:Ax = 7:25 */
enum {
OP_NOP=0,/* */
OP_MOVE,/* A B R(A) := R(B) */
OP_LOADL,/* A Bx R(A) := Lit(Bx) */
OP_LOADI,/* A sBx R(A) := sBx */
OP_LOADSYM,/* A Bx R(A) := Sym(Bx) */
OP_LOADNIL,/* A R(A) := nil */
OP_LOADSELF,/* A R(A) := self */
OP_LOADT,/* A R(A) := true */
OP_LOADF,/* A R(A) := false */
#define DIRECT_THREADED
#ifndef DIRECT_THREADED
#define INIT_DISPACTH for (;;) { i = *pc; switch (GET_OPCODE(i)) {
#define CASE(op) case op:
#define NEXT mrb->arena_idx = ai; pc++; break
#define JUMP break
#define END_DISPACTH }}
#else
typedef struct mrb_value {
union {
mrb_float f;
void *p;
mrb_int i;
mrb_sym sym;
} value;
enum mrb_vtype tt:8;
} mrb_value;
#define GET_OPCODE(i) (((mrb_code)(i)) & 0x7f)
8cc: e1b00ba8 lsrs r0, r8, #23
8d0: 0a000008 beq 8f8 <mrb_run+0x724>
#define GETARG_A(i) ((((mrb_code)(i)) >> 23) & 0x1ff)
#include <SDL.h>
int main()
{
int ret;
SDL_Window *w1, *w2;
Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;
int i, j;
ret = SDL_Init(SDL_INIT_VIDEO);
#include <SDL.h>
int main()
{
int ret;
SDL_Window *w;
SDL_Event e;
int done = 0;
ret = SDL_Init(SDL_INIT_VIDEO);