Fix segfault when processing memory input without newline.
Fix warnings on implicit function declarations.
Changes to allow usage on big-endian architectures.