Issue #19641: Added the audioop.byteswap() function to convert big-endian

samples to little-endian and vice versa.
This commit is contained in:
Serhiy Storchaka 2013-11-23 22:26:01 +02:00
parent 2b38fc187c
commit 3062c9a6c8
10 changed files with 80 additions and 78 deletions

View file

@ -5,24 +5,6 @@ import io
import pickle
import sys
def byteswap2(data):
a = array.array('h')
a.frombytes(data)
a.byteswap()
return a.tobytes()
def byteswap3(data):
ba = bytearray(data)
ba[::3] = data[2::3]
ba[2::3] = data[::3]
return bytes(ba)
def byteswap4(data):
a = array.array('i')
a.frombytes(data)
a.byteswap()
return a.tobytes()
class UnseekableIO(io.FileIO):
def tell(self):
raise io.UnsupportedOperation