mirror of https://github.com/nodejs/node.git
buffer: align fast buffers on 8 byte boundary
Prevents alignment issues when people create a typed array from a buffer. Unaligned loads or stores are less efficent and (on some architectures) unsafe.pull/24503/head
parent
67fc1dafd0
commit
285d8c6589
|
@ -250,6 +250,7 @@ function Buffer(subject, encoding, offset) {
|
|||
this.parent = pool;
|
||||
this.offset = pool.used;
|
||||
pool.used += this.length;
|
||||
if (pool.used & 7) pool.used = (pool.used + 8) & ~7;
|
||||
}
|
||||
|
||||
// Treat array-ish objects as a byte array.
|
||||
|
|
Loading…
Reference in New Issue