Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge shortbytestring package back into bytestring wrt #444 #471

Merged
merged 73 commits into from
Feb 15, 2022
Merged
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
2125e9d
Merge `shortbytestring` package back into `bytestring` wrt #444
hasufell Jan 21, 2022
46b128a
Fix build on ARM
hasufell Jan 21, 2022
09a8916
Speed up reverse by using byteSwap64 tricks
hasufell Jan 22, 2022
d69c427
Remove phase control from inlines
hasufell Jan 22, 2022
cb349be
Improve performance of elemIndex
hasufell Jan 22, 2022
e29f102
Use setByteArray in replicate
hasufell Jan 22, 2022
fcb3170
Implement intercalate manually
hasufell Jan 22, 2022
5975e88
Annotate partial functions with HasCallStack
hasufell Jan 22, 2022
f78661a
Fix build on base < 4.12.0.0
hasufell Jan 22, 2022
b88e4fe
Add uncons/unsnoc
hasufell Jan 22, 2022
c2b2bfd
Correct complexities
hasufell Jan 22, 2022
6fb3195
Exclude reverse optimization path from ARM
hasufell Jan 23, 2022
6cf6dce
Add benchmarks for ShortByteString
hasufell Jan 24, 2022
df1c784
Improve inlining
hasufell Jan 24, 2022
e492432
Adjust haddock identifiers
hasufell Jan 24, 2022
6238e76
Get rid of writeCharArray#
hasufell Jan 24, 2022
ecc57b1
Haddock fixes
hasufell Jan 24, 2022
f06fdf5
Clean up tests
hasufell Jan 25, 2022
ba067f8
Use -fexpose-all-unfoldings
hasufell Jan 25, 2022
cdd34a5
Improve reverse
hasufell Jan 25, 2022
04eb82f
Cleanup 'reverse'
hasufell Jan 25, 2022
95aa7ab
Fix possible GC race with foreign imports
hasufell Jan 27, 2022
96caf73
Disable asserts in shortbytestring.c
hasufell Jan 27, 2022
00606ab
Remove redundant import
hasufell Jan 27, 2022
454b3b5
Add documentation about partial functions
hasufell Jan 27, 2022
b3f90b4
Fold ShortByteString prop tests into ByteString
hasufell Jan 27, 2022
0140332
Restore previous INLINEs
hasufell Jan 30, 2022
5acda9d
Improve naming of bindings
hasufell Jan 30, 2022
1be5f98
Consolidate error handling functions
hasufell Jan 30, 2022
01a760b
Remove trailing whitespace
hasufell Jan 30, 2022
4bc5bce
Fix uncons in documentation
hasufell Jan 30, 2022
bea295a
Rename indexWord64Array to indexWord8ArrayAsWord64
hasufell Jan 30, 2022
557f5f6
Improve error message
hasufell Jan 30, 2022
2855d47
Clean up incorrect documentation
hasufell Jan 30, 2022
ac32771
Use div/mod instead of quot/rem
hasufell Jan 30, 2022
afafd32
Simplify branching in reverse
hasufell Jan 30, 2022
2ff0e3c
Move asserts to Haskell
hasufell Jan 30, 2022
a1aec25
Prefix C functions
hasufell Jan 30, 2022
2246ce1
Fix return type of c_elem_index
hasufell Jan 30, 2022
441cc5e
Fix documentation in unfoldrN
hasufell Jan 30, 2022
d2834df
Make unfoldrN more efficient
hasufell Jan 30, 2022
51467b8
Fix maintainer field
hasufell Jan 30, 2022
9b77b82
Fix formatting
hasufell Jan 30, 2022
0e945f5
Implement takeEnd, dropeEnd and splitAt manually
hasufell Jan 30, 2022
f5a4d7a
Fix some haddock identifiers
hasufell Jan 30, 2022
e5fcb93
Fix unfoldrN doc
hasufell Jan 30, 2022
b389c42
Add a primops bounds-checking job to CI
hasufell Jan 31, 2022
81b1e8e
Document and clean up createAndTrim
hasufell Feb 1, 2022
6ef1b41
Rename errorEmptyList to errorEmptySBS
hasufell Feb 1, 2022
b1ce7fd
Improve documentation for findFromEndUntil
hasufell Feb 1, 2022
7ba6ed1
Improve documentation and naming
hasufell Feb 6, 2022
a7e0765
Optimize out quotRem
hasufell Feb 6, 2022
bb7924a
Document compareByteArraysOff
hasufell Feb 7, 2022
820827f
Simplify findIndexOrLength and findFromEndUntil
hasufell Feb 7, 2022
fc988b5
Use c_count for count
hasufell Feb 7, 2022
e72b3f9
Simplify elemIndex
hasufell Feb 7, 2022
409c1fc
Remove use of 'mempty'
hasufell Feb 7, 2022
ae7ff05
Make sure breakSubstring is inlined into isInfixOf
hasufell Feb 7, 2022
08c8b5d
Simplify stripSuffix and stripPrefix
hasufell Feb 7, 2022
3d0c977
Fix redundant import warnings
hasufell Feb 7, 2022
e05f05d
Improve 'take'
hasufell Feb 7, 2022
659edd9
Use existing bounnds check in 'drop'
hasufell Feb 7, 2022
fd83ec2
Avoid 'create' when bytestring is empty
hasufell Feb 7, 2022
98450fc
Optimize filter
hasufell Feb 7, 2022
b647760
Remove redundant INLINABLE
hasufell Feb 7, 2022
6289d9f
Use shorter 'createAndTrim' in 'filter'
hasufell Feb 7, 2022
28b8686
Simplify 'take'
hasufell Feb 7, 2022
bc90b58
Simplify 'drop'
hasufell Feb 7, 2022
fed9a73
Better formatting
hasufell Feb 7, 2022
213218c
Add comment to explain DNDEBUG
hasufell Feb 8, 2022
04e2392
Refactor elemIndex
hasufell Feb 8, 2022
3d6722b
Optimize 'partition'
hasufell Feb 8, 2022
d12ad66
Optimize hot loop in 'partition'
hasufell Feb 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix return type of c_elem_index
  • Loading branch information
hasufell committed Jan 30, 2022
commit 2246ce1ea4d4ad3872949be3877dc382730fa729
7 changes: 4 additions & 3 deletions Data/ByteString/Short/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ import Control.Applicative (pure)
import Control.Monad ((>>))
import Control.DeepSeq (NFData(..))
import Foreign.C.String (CString, CStringLen)
import Foreign.C.Types (CSize(..), CInt(..))
import Foreign.C.Types (CSize(..), CInt(..), CPtrdiff(..))
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.ForeignPtr (touchForeignPtr)
import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
Expand Down Expand Up @@ -210,6 +210,7 @@ import Prelude ( Eq(..), Ord(..), Ordering(..), Read(..), Show(..)
, (+), (-), fromIntegral
, (*)
, (^)
, (<$>)
, return
, Maybe(..)
, not
Expand Down Expand Up @@ -1340,7 +1341,7 @@ partition f = \sbs -> if
--
-- @since 0.11.3.0
elemIndex :: Word8 -> ShortByteString -> Maybe Int
elemIndex c = \(SBS ba#) -> do
elemIndex c = \(SBS ba#) -> fromIntegral <$> do
let l = I# (sizeofByteArray# ba#)
accursedUnutterablePerformIO $ do
!s <- c_elem_index ba# c (fromIntegral l)
Expand Down Expand Up @@ -1507,7 +1508,7 @@ foreign import ccall unsafe "static sbs_memcmp_off"
#endif

foreign import ccall unsafe "static sbs_elem_index"
c_elem_index :: ByteArray# -> Word8 -> CSize -> IO Int
c_elem_index :: ByteArray# -> Word8 -> CSize -> IO CPtrdiff


------------------------------------------------------------------------
Expand Down