(bind-func qbuf_peek:[!a,QBuffer*,i64]*
(lambda (buf idx)
(if (>= (+ (tref buf 0) idx) (tref buf 1))
(begin
(printout "Peeking past write! p(" (+ (tref buf 0) idx) ") w(" (tref buf 1) ")")
(println)))
(pref (tref buf 3)
(% (+ (tref buf 0) idx)
(tref buf 2)))))