convert buffer to bits directly