Android buffer implemented in C