def _reversebytes(self, start, end):
        """Reverse bytes in-place."""
        # Make the start occur on a byte boundary
        # TODO: We could be cleverer here to avoid changing the offset.
        newoffset = 8 - (start % 8)
        if newoffset == 8:
            newoffset = 0
        self._datastore = offsetcopy(self._datastore, newoffset)
        # Now just reverse the byte data
        toreverse = bytearray(self._datastore.getbyteslice((newoffset + start) // 8, (newoffset + end) // 8))
        toreverse.reverse()
        self._datastore.setbyteslice((newoffset + start) // 8, (newoffset + end) // 8, toreverse)
def _reversebytes ( self , start , end ) : newoffset = 8 - ( start % 8 ) if newoffset == 8 : newoffset = 0 self . _datastore = offsetcopy ( self . _datastore , newoffset ) toreverse = bytearray ( self . _datastore . getbyteslice ( ( newoffset + start ) // 8 , ( newoffset + end ) // 8 ) ) toreverse . reverse ( ) self . _datastore . setbyteslice ( ( newoffset + start ) // 8 , ( newoffset + end ) // 8 , toreverse )
Reverse bytes in-place.