(bind-func qbuf_pop:[!a,QBuffer*]*
(lambda (buf)
(if (>= (tref buf 0) (tref buf 1))
(begin
(println "Trying to pop past write! p(" (tref buf 0) ") w(" (tref buf 1) ")")
(println)))
(tset! buf 0 (+ (tref buf 0) 1))
(pref (tref buf 3)
(% (- (tref buf 0) 1)
(tref buf 2)))))