Repository navigation
Commit 3cbc0a6
committed
Mask packed elements and hash bytes in Fold.takeEndBySeq
When the pattern fits in a machine word, Fold.takeEndBySeq packs the
elements into a Word using fromEnum. A negative fromEnum sets all the
upper bits, so for Int8 the pattern [1,-1] matched the input [-1,-1].
addToWord now masks each element to its size.
The Karp-Rabin hash used for longer patterns called fromEnum, which
fails on Word64 values above maxBound :: Int. Use the byte hash from
Streamly.Internal.Data.SeqMatch, as splitSepByOneOf does. Use
RingArray.replace_ as the replaced element is not needed.1 parent ddc9afd commit 3cbc0a6
3 files changed
Lines changed: 17 additions & 14 deletions
File tree
- core/src/Streamly/Internal/Data
- Fold
- test/Streamly/Test/Data/Fold
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1395 | 1395 | | |
1396 | 1396 | | |
1397 | 1397 | | |
| 1398 | + | |
| 1399 | + | |
1398 | 1400 | | |
1399 | 1401 | | |
1400 | 1402 | | |
| |||
1403 | 1405 | | |
1404 | 1406 | | |
1405 | 1407 | | |
1406 | | - | |
| 1408 | + | |
1407 | 1409 | | |
1408 | 1410 | | |
1409 | | - | |
1410 | | - | |
1411 | | - | |
1412 | | - | |
| 1411 | + | |
| 1412 | + | |
1413 | 1413 | | |
1414 | 1414 | | |
1415 | 1415 | | |
1416 | 1416 | | |
1417 | 1417 | | |
1418 | 1418 | | |
1419 | | - | |
| 1419 | + | |
1420 | 1420 | | |
1421 | 1421 | | |
1422 | 1422 | | |
| |||
1464 | 1464 | | |
1465 | 1465 | | |
1466 | 1466 | | |
1467 | | - | |
| 1467 | + | |
1468 | 1468 | | |
1469 | 1469 | | |
1470 | 1470 | | |
| |||
1480 | 1480 | | |
1481 | 1481 | | |
1482 | 1482 | | |
1483 | | - | |
1484 | | - | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
1485 | 1487 | | |
1486 | 1488 | | |
1487 | 1489 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
590 | 590 | | |
591 | 591 | | |
592 | 592 | | |
593 | | - | |
| 593 | + | |
594 | 594 | | |
595 | 595 | | |
596 | | - | |
| 596 | + | |
597 | 597 | | |
598 | 598 | | |
599 | 599 | | |
| |||
0 commit comments