mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 11:04:30 +00:00
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.
This commit is contained in:
parent
67fc1dafd0
commit
285d8c6589
@ -250,6 +250,7 @@ function Buffer(subject, encoding, offset) {
|
|||||||
this.parent = pool;
|
this.parent = pool;
|
||||||
this.offset = pool.used;
|
this.offset = pool.used;
|
||||||
pool.used += this.length;
|
pool.used += this.length;
|
||||||
|
if (pool.used & 7) pool.used = (pool.used + 8) & ~7;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Treat array-ish objects as a byte array.
|
// Treat array-ish objects as a byte array.
|
||||||
|
Loading…
Reference in New Issue
Block a user