equal
deleted
inserted
replaced
1288 at stop, anInteger. |
1288 at stop, anInteger. |
1289 - reimplemented here for speed" |
1289 - reimplemented here for speed" |
1290 |
1290 |
1291 %{ /* NOCONTEXT */ |
1291 %{ /* NOCONTEXT */ |
1292 |
1292 |
1293 #if !defined(FAST_MEMCPY) |
|
1294 REGISTER unsigned char *srcp; |
1293 REGISTER unsigned char *srcp; |
1295 #endif |
|
1296 REGISTER unsigned char *dstp; |
1294 REGISTER unsigned char *dstp; |
1297 REGISTER int count; |
1295 REGISTER int count; |
1298 int len, index1, index2, sz; |
1296 int len, index1, index2, sz; |
1299 OBJ newByteArray; |
1297 OBJ newByteArray; |
1300 |
1298 |
1312 __qNew(newByteArray, sz); |
1310 __qNew(newByteArray, sz); |
1313 __UNPROTECT_CONTEXT__ |
1311 __UNPROTECT_CONTEXT__ |
1314 if (newByteArray != nil) { |
1312 if (newByteArray != nil) { |
1315 __InstPtr(newByteArray)->o_class = ByteArray; |
1313 __InstPtr(newByteArray)->o_class = ByteArray; |
1316 dstp = __ByteArrayInstPtr(newByteArray)->ba_element; |
1314 dstp = __ByteArrayInstPtr(newByteArray)->ba_element; |
|
1315 srcp = __ByteArrayInstPtr(self)->ba_element + index1 - 1; |
|
1316 |
|
1317 #ifdef bcopy4 |
|
1318 if ((((unsigned)srcp & 3) == 0) |
|
1319 && (((unsigned)dstp & 3) == 0)) { |
|
1320 /* copy aligned part */ |
|
1321 int nW = count >> 2; |
|
1322 |
|
1323 if (count & 3) { |
|
1324 nW++; |
|
1325 } |
|
1326 bcopy4(srcp, dstp, nW); |
|
1327 RETURN ( newByteArray ); |
|
1328 } |
|
1329 #endif /* bcopy4 */ |
|
1330 |
1317 #ifdef FAST_MEMCPY |
1331 #ifdef FAST_MEMCPY |
1318 bcopy(__ByteArrayInstPtr(self)->ba_element + index1 - 1, dstp, count); |
1332 bcopy(srcp, dstp, count); |
1319 #else |
1333 #else |
1320 srcp = __ByteArrayInstPtr(self)->ba_element + index1 - 1; |
|
1321 while (count--) { |
1334 while (count--) { |
1322 *dstp++ = *srcp++; |
1335 *dstp++ = *srcp++; |
1323 } |
1336 } |
1324 #endif |
1337 #endif |
1325 RETURN ( newByteArray ); |
1338 RETURN ( newByteArray ); |
1487 && (((unsigned)dst & 3) == 0)) { |
1500 && (((unsigned)dst & 3) == 0)) { |
1488 /* copy aligned part */ |
1501 /* copy aligned part */ |
1489 int nW = count >> 2; |
1502 int nW = count >> 2; |
1490 |
1503 |
1491 bcopy4(src, dst, nW); |
1504 bcopy4(src, dst, nW); |
1492 /* copy rest */ |
1505 if ((count = count & 3) != 0) { |
1493 if (count & 3) { |
1506 src += (nW<<2); |
1494 src += (count & ~3); |
1507 dst += (nW<<2); |
1495 dst += (count & ~3); |
|
1496 count = count & 3; |
|
1497 while (count--) { |
1508 while (count--) { |
1498 *dst++ = *src++; |
1509 *dst++ = *src++; |
1499 } |
1510 } |
1500 } |
1511 } |
1501 RETURN ( self ); |
1512 RETURN ( self ); |
1502 } |
1513 } |
1503 #endif /* bcopy4 */ |
1514 #endif /* bcopy4 */ |
2308 ! ! |
2319 ! ! |
2309 |
2320 |
2310 !ByteArray class methodsFor:'documentation'! |
2321 !ByteArray class methodsFor:'documentation'! |
2311 |
2322 |
2312 version |
2323 version |
2313 ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.79 1997-04-24 14:23:20 cg Exp $' |
2324 ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.80 1997-05-14 14:54:38 cg Exp $' |
2314 ! ! |
2325 ! ! |