def _fix_offset(self, state, size, arch=None):
        """
        This is a hack to deal with small values being stored at offsets into large registers unpredictably
        """
        if state is not None:
            arch = state.arch

        if arch is None:
            raise ValueError('Either "state" or "arch" must be specified.')

        offset = arch.registers[self.reg_name][0]
        if size in self.alt_offsets:
            return offset + self.alt_offsets[size]
        elif size < self.size and arch.register_endness == 'Iend_BE':
            return offset + (self.size - size)
        return offset
This is a hack to deal with small values being stored at offsets into large registers unpredictably