Merge pull request #794 from datastax/python-653
PYTHON-653: Fix murmur3 on big-endian systems
This commit is contained in:
		@@ -13,6 +13,7 @@ Bug Fixes
 | 
				
			|||||||
* Installation doesn't always fall back to no cython in Windows (PYTHON-763)
 | 
					* Installation doesn't always fall back to no cython in Windows (PYTHON-763)
 | 
				
			||||||
* Avoid to replace a connection that is supposed to shutdown (PYTHON-772)
 | 
					* Avoid to replace a connection that is supposed to shutdown (PYTHON-772)
 | 
				
			||||||
* request_ids may not be returned to the pool (PYTHON-739)
 | 
					* request_ids may not be returned to the pool (PYTHON-739)
 | 
				
			||||||
 | 
					* Fix murmur3 on big-endian systems (PYTHON-653)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Other
 | 
					Other
 | 
				
			||||||
-----
 | 
					-----
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,9 @@ def body_and_tail(data):
 | 
				
			|||||||
    nblocks = l // 16
 | 
					    nblocks = l // 16
 | 
				
			||||||
    tail = l % 16
 | 
					    tail = l % 16
 | 
				
			||||||
    if nblocks:
 | 
					    if nblocks:
 | 
				
			||||||
        return struct.unpack_from('qq' * nblocks, data), struct.unpack_from('b' * tail, data, -tail), l
 | 
					        # we use '<', specifying little-endian byte order for data bigger than
 | 
				
			||||||
 | 
					        # a byte so behavior is the same on little- and big-endian platforms
 | 
				
			||||||
 | 
					        return struct.unpack_from('<' + ('qq' * nblocks), data), struct.unpack_from('b' * tail, data, -tail), l
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        return tuple(), struct.unpack_from('b' * tail, data, -tail), l
 | 
					        return tuple(), struct.unpack_from('b' * tail, data, -tail), l
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user