def _read_full_file(x, path):
    """Reads the full contentes of file path into array x."""
    with open(path, 'rb') as reader:
        reader.seek(0, 2)
        size = reader.tell()
        reader.seek(0, 0)
        if size % x.itemsize != 0:
            raise Exception('Truncated file')
        x.fromfile(reader, size // x.itemsize)
        return x
