ByteArray.st
changeset 4945 2e67ed09d194
parent 4944 e06f2428c0a4
child 4969 bd9f02a6a74f
equal deleted inserted replaced
4944:e06f2428c0a4 4945:2e67ed09d194
  1195     "
  1195     "
  1196     ^ super copyFrom:start to:stop
  1196     ^ super copyFrom:start to:stop
  1197 
  1197 
  1198     "
  1198     "
  1199      #[1 2 3 4 5 6 7 8 9 10] copyFrom:1 to:10    
  1199      #[1 2 3 4 5 6 7 8 9 10] copyFrom:1 to:10    
  1200      #[1 2 3 4 5 6 7 8 9 10] copyFrom:5 to:7    
  1200      #[1 2 3 4 5 6 7 8 9 10] copyFrom:5 to:7  
       
  1201 
  1201      #[1 2 3 4 5 6 7 8 9 10] copyFrom:5 to:11    
  1202      #[1 2 3 4 5 6 7 8 9 10] copyFrom:5 to:11    
  1202      #[1 2 3 4 5 6 7 8 9 10] copyFrom:0 to:10    
  1203      #[1 2 3 4 5 6 7 8 9 10] copyFrom:0 to:10    
  1203      #[1 2 3 4 5 6 7 8 9 10] copyFrom:0 to:9    
  1204      #[1 2 3 4 5 6 7 8 9 10] copyFrom:0 to:9    
  1204     "
  1205     "
  1205 !
  1206 !
  1324                     }
  1325                     }
  1325                     RETURN (self);
  1326                     RETURN (self);
  1326                 }
  1327                 }
  1327 #endif /* memset4 */
  1328 #endif /* memset4 */
  1328 
  1329 
       
  1330 #ifdef alpha64
       
  1331                 {
       
  1332                     INT v8;
       
  1333 
       
  1334                     v8 = (value << 8) | value;
       
  1335                     v8 = (v8 << 16) | v8;
       
  1336                     v8 = (v8 << 32) | v8;
       
  1337 
       
  1338                     /* fill unaligned part */
       
  1339                     while ((count > 0) && (((unsigned INT)dstp & 3) != 0)) {
       
  1340                         *dstp++ = value;
       
  1341                         count--;
       
  1342                     }
       
  1343 
       
  1344                     if ((count >= 4) && (((unsigned INT)dstp & 7) != 0)) {
       
  1345                         ((unsigned int *)dstp)[0] = v8;
       
  1346                         dstp += 4;
       
  1347                         count -= 4;
       
  1348                     }
       
  1349 
       
  1350                     /* fill aligned part */
       
  1351                     while (count >= 8) {
       
  1352                         ((unsigned INT *)dstp)[0] = v8;
       
  1353                         dstp += 8;
       
  1354                         count -= 8;
       
  1355                     }
       
  1356 
       
  1357                     /* fill rest */
       
  1358                     if (count >= 4) {
       
  1359                         ((unsigned int *)dstp)[0] = v8;
       
  1360                         dstp += 4;
       
  1361                         count -= 4;
       
  1362                     }
       
  1363                     if (count >= 2) {
       
  1364                         ((unsigned short *)dstp)[0] = v8;
       
  1365                         dstp += 2;
       
  1366                         count -= 2;
       
  1367                     }
       
  1368                     if (count) {
       
  1369                         *dstp = value;
       
  1370                     }
       
  1371                     RETURN (self);
       
  1372                 }
       
  1373 #endif /* alpha64 */
       
  1374 
  1329 #ifdef FAST_MEMSET
  1375 #ifdef FAST_MEMSET
  1330                 memset(dstp, value, count);
  1376                 memset(dstp, value, count);
  1331 #else
  1377 #else
  1332 # ifdef UNROLL_LOOPS
  1378 # ifdef UNROLL_LOOPS
  1333                 while (count >= 8) {
  1379                 while (count >= 8) {
  1349     "
  1395     "
  1350      fall back in case of non-integer index or out-of-bound index/value;
  1396      fall back in case of non-integer index or out-of-bound index/value;
  1351      will eventually lead to an out-of-bound signal raise
  1397      will eventually lead to an out-of-bound signal raise
  1352     "
  1398     "
  1353     ^ super from:start to:stop put:aNumber
  1399     ^ super from:start to:stop put:aNumber
       
  1400 
       
  1401     "
       
  1402      (ByteArray new:10) from:1 to:10 put:1 
       
  1403      (ByteArray new:20) from:10 to:20 put:1 
       
  1404      (ByteArray new:20) from:1 to:10 put:1 
       
  1405     "
  1354 !
  1406 !
  1355 
  1407 
  1356 replaceBytesFrom:start to:stop with:aCollection startingAt:repStart
  1408 replaceBytesFrom:start to:stop with:aCollection startingAt:repStart
  1357     "replace elements from another collection, which must be a ByteArray-
  1409     "replace elements from another collection, which must be a ByteArray-
  1358      like collection.
  1410      like collection.
  2806 ! !
  2858 ! !
  2807 
  2859 
  2808 !ByteArray class methodsFor:'documentation'!
  2860 !ByteArray class methodsFor:'documentation'!
  2809 
  2861 
  2810 version
  2862 version
  2811     ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.130 1999-10-26 18:45:29 cg Exp $'
  2863     ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.131 1999-10-26 18:58:48 cg Exp $'
  2812 ! !
  2864 ! !