Skip to content

Commit

Permalink
Merge pull request #2 from daisuke-t-jp/xcode12
Browse files Browse the repository at this point in the history
Xcode12
  • Loading branch information
daisuke-t-jp committed Sep 23, 2020
2 parents 44c7d1d + a65a96f commit 1fbd877
Show file tree
Hide file tree
Showing 69 changed files with 3,501 additions and 9,764 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,3 @@ Carthage/
# SwiftPM
/.build
/Packages

# jazzy
undocumented.json
6 changes: 0 additions & 6 deletions .jazzy.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0
5.3
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ matrix:
include:
- os: osx
language: swift
osx_image: xcode10.2
osx_image: xcode12
script:
# iOS
- xcodebuild clean -project "xxHash.xcodeproj"
- xcodebuild test -project "xxHash.xcodeproj" -scheme "xxHash-iOS" -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone X" -configuration Debug
- xcodebuild test -project "xxHash.xcodeproj" -scheme "xxHash-iOS" -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 11 Pro Max" -configuration Debug

# macOS
- xcodebuild clean -project "xxHash.xcodeproj"
Expand Down Expand Up @@ -54,8 +54,8 @@ matrix:
- tzdata
- rsync
script:
- wget https://swift.org/builds/swift-5.0-release/ubuntu1604/swift-5.0-RELEASE/swift-5.0-RELEASE-ubuntu16.04.tar.gz
- tar xvfz swift-5.0-RELEASE-ubuntu16.04.tar.gz
- export PATH=$(pwd)/swift-5.0-RELEASE-ubuntu16.04/usr/bin:"${PATH}"
- wget https://swift.org/builds/swift-5.3-release/ubuntu1604/swift-5.3-RELEASE/swift-5.3-RELEASE-ubuntu16.04.tar.gz
- tar xvfz swift-5.3-RELEASE-ubuntu16.04.tar.gz
- export PATH=$(pwd)/swift-5.3-RELEASE-ubuntu16.04/usr/bin:"${PATH}"
- swift build
- swift test
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019 Daisuke T
Copyright (c) 2019 Daisuke TONOSAKI

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
48 changes: 24 additions & 24 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@ import PackageDescription

#if os(Linux) || os(macOS) || os(iOS) || os(tvOS)
let package = Package(
name: "xxHash-Swift",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "xxHash-Swift",
targets: ["xxHash_Swift"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "xxHash_Swift",
dependencies: [],
path: "Sources/xxHash/",
exclude: ["xxHash.xcodeproj", "README.md", "Sources/xxHash/Info.plist", "Sources/xxHash/xxHash.h"]),
.testTarget(
name: "xxHashTests",
dependencies: ["xxHash_Swift"]),
],
swiftLanguageVersions: [.v5]
name: "xxHash-Swift",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "xxHash-Swift",
targets: ["xxHash_Swift"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "xxHash_Swift",
dependencies: [],
path: "Sources/xxHash/",
exclude: ["xxHash.xcodeproj", "README.md", "Sources/xxHash/Info.plist", "Sources/xxHash/xxHash.h"]),
.testTarget(
name: "xxHashTests",
dependencies: ["xxHash_Swift"]),
],
swiftLanguageVersions: [.v5]
)
#else
fatalError("Unsupported OS")
Expand Down
67 changes: 24 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
A framework includes XXH32/XXH64/XXH3-64/XXH3-128 functions.

Original xxHash algorithm created by [Yann Collet](https://github.com/Cyan4973).

[Documentation](https://daisuke-t-jp.github.io/xxHash-Swift/)


# Requirements
Expand All @@ -40,23 +38,6 @@ pod 'xxHash-Swift'
end
```

## Swift Package Manager
```swift
import PackageDescription

let package = Package(
name: "YOUR_PACKAGE_NAME",
dependencies: [
.package(url: "https://github.com/daisuke-t-jp/xxHash-Swift.git", from: "1.0.12")
],
targets: [
.target(
name: "YOUR_TARGET_NAME",
dependencies: ["xxHash-Swift"]),
]
)
```


# Usage
## Import framework
Expand Down Expand Up @@ -91,18 +72,18 @@ let bufSize = 1024
var index = 0

repeat {
var lastIndex = index + bufSize
if lastIndex > data.count {
lastIndex = index + data.count - index
}

let data2 = data[index..<lastIndex]
xxh.update(data2) // xxHash update

index += data2.count
if index >= data.count {
break
}
var lastIndex = index + bufSize
if lastIndex > data.count {
lastIndex = index + data.count - index
}

let data2 = data[index..<lastIndex]
xxh.update(data2) // xxHash update

index += data2.count
if index >= data.count {
break
}
} while(true)

let digest = xxh.digest()
Expand Down Expand Up @@ -135,18 +116,18 @@ let bufSize = 1024
var index = 0

repeat {
var lastIndex = index + bufSize
if lastIndex > data.count {
lastIndex = index + data.count - index
}

let data2 = data[index..<lastIndex]
xxh.update(data2) // xxHash update

index += data2.count
if index >= data.count {
break
}
var lastIndex = index + bufSize
if lastIndex > data.count {
lastIndex = index + data.count - index
}

let data2 = data[index..<lastIndex]
xxh.update(data2) // xxHash update

index += data2.count
if index >= data.count {
break
}
} while(true)

let digest = xxh.digest()
Expand Down
4 changes: 2 additions & 2 deletions Sources/xxHash/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.13</string>
<string>1.1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 xxHash. All rights reserved.</string>
<string>Copyright © 2019 Daisuke TONOSAKI. All rights reserved.</string>
</dict>
</plist>
Loading

0 comments on commit 1fbd877

Please sign in to comment.