Add UNUSED macro, NDEBUG to release build.
Change exception to assert.

This should make the read methods much easier to inline in release mode.