blob: 5cc0f48d92fd19ca429a03bcd1ac0f83068d3b42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
function _memset(ptr, value, num) {
ptr = ptr | 0;
value = value | 0;
num = num | 0;
var stop = 0, value4 = 0, unaligned = 0;
stop = ptr + num | 0;
if ((num | 0) >= 20) {
value = value & 255;
unaligned = ptr & 3;
value4 = value | value << 8 | value << 16 | value << 24;
if (unaligned) {
unaligned = ptr + 4 - unaligned | 0;
while ((ptr | 0) < (unaligned | 0)) {
HEAP8[ptr] = value;
ptr = ptr + 1 | 0;
}
}
while ((ptr | 0) < (stop & ~3 | 0)) {
HEAP32[ptr >> 2] = value4;
ptr = ptr + 4 | 0;
}
}
while ((ptr | 0) < (stop | 0)) {
HEAP8[ptr] = value;
ptr = ptr + 1 | 0;
}
}
|