From 28bc6a1e5a8cbe63bf3f2891b6e9c4ddf2903d3d Mon Sep 17 00:00:00 2001 From: daisuke-t-jp Date: Fri, 26 Apr 2019 17:11:00 +0900 Subject: [PATCH] Update indent --- Sources/MurmurHash/Common.swift | 6 +- Sources/MurmurHash/MurmurHash3_x64_128.swift | 4 +- Sources/MurmurHash/MurmurHash3_x86_128.swift | 80 +++++++++---------- Sources/MurmurHash/MurmurHash3_x86_32.swift | 6 +- Tests/MurmurHashTests/MurmurHashTests.swift | 28 +++---- demo/Common.swift | 10 +-- .../MurmurHashDemoMacOS/AppDelegate.swift | 12 +-- .../MurmurHashDemoMacOS/ViewController.swift | 14 ++-- .../MurmurHashDemoTvOS/AppDelegate.swift | 20 ++--- .../MurmurHashDemoTvOS/ViewController.swift | 4 +- .../MurmurHashDemoiOS/AppDelegate.swift | 20 ++--- .../MurmurHashDemoiOS/ViewController.swift | 6 +- 12 files changed, 105 insertions(+), 105 deletions(-) diff --git a/Sources/MurmurHash/Common.swift b/Sources/MurmurHash/Common.swift index 1bd10fd..85bb0fd 100644 --- a/Sources/MurmurHash/Common.swift +++ b/Sources/MurmurHash/Common.swift @@ -10,7 +10,7 @@ import Foundation import CoreFoundation final class Common { - + // MARK: - Enum, Const enum Endian { case little @@ -72,7 +72,7 @@ extension Common { // MARK: - Utility(Convert) extension Common { - + static private func UInt8ArrayToUInt(_ array: [UInt8], index: Int) -> T { var block: T = 0 @@ -96,7 +96,7 @@ extension Common { return block } - + static func UInt32ArrayToHex(_ array: [UInt32]) -> String { var hex = "" diff --git a/Sources/MurmurHash/MurmurHash3_x64_128.swift b/Sources/MurmurHash/MurmurHash3_x64_128.swift index ad63e2e..7c12a21 100644 --- a/Sources/MurmurHash/MurmurHash3_x64_128.swift +++ b/Sources/MurmurHash/MurmurHash3_x64_128.swift @@ -67,7 +67,7 @@ extension MurmurHash3.x64_128 { var k1: UInt64 = Common.UInt8ArrayToUInt(array, index: i * 2 + 0, endian: Common.endian()) var k2: UInt64 = Common.UInt8ArrayToUInt(array, index: i * 2 + 1, endian: Common.endian()) - + k1 &*= c1 k1 = Common.rotl(k1, r: 31) k1 &*= c2 @@ -305,7 +305,7 @@ extension MurmurHash3.x64_128 { // fill in tmp buffer state.memSize = array2.count % 16 state.mem.replaceSubrange(0.. [UInt32] { let nblocks = array.count / 16 var h1: UInt32 = h[0] var h2: UInt32 = h[1] var h3: UInt32 = h[2] var h4: UInt32 = h[3] - + for i in 0.. [UInt32] { var k1: UInt32 = 0 var k2: UInt32 = 0 @@ -124,7 +124,7 @@ extension MurmurHash3.x86_128 { var h2: UInt32 = h[1] var h3: UInt32 = h[2] var h4: UInt32 = h[3] - + /** * tail */ @@ -132,11 +132,11 @@ extension MurmurHash3.x86_128 { case 15: k4 ^= UInt32(tail[14]) << 16 fallthrough - + case 14: k4 ^= UInt32(tail[13]) << 8 fallthrough - + case 13: k4 ^= UInt32(tail[12]) << 0 k4 &*= c4 @@ -144,20 +144,20 @@ extension MurmurHash3.x86_128 { k4 &*= c1 h4 ^= k4 fallthrough - - + + case 12: k3 ^= UInt32(tail[11]) << 24 fallthrough - + case 11: k3 ^= UInt32(tail[10]) << 16 fallthrough - + case 10: k3 ^= UInt32(tail[9]) << 8 fallthrough - + case 9: k3 ^= UInt32(tail[8]) << 0 k3 &*= c3 @@ -165,20 +165,20 @@ extension MurmurHash3.x86_128 { k3 &*= c4 h3 ^= k3 fallthrough - - + + case 8: k2 ^= UInt32(tail[7]) << 24 fallthrough - + case 7: k2 ^= UInt32(tail[6]) << 16 fallthrough - + case 6: k2 ^= UInt32(tail[5]) << 8 fallthrough - + case 5: k2 ^= UInt32(tail[4]) << 0 k2 &*= c2 @@ -186,32 +186,32 @@ extension MurmurHash3.x86_128 { k2 &*= c3 h2 ^= k2 fallthrough - - + + case 4: k1 ^= UInt32(tail[3]) << 24 fallthrough - + case 3: k1 ^= UInt32(tail[2]) << 16 fallthrough - + case 2: k1 ^= UInt32(tail[1]) << 8 fallthrough - + case 1: k1 ^= UInt32(tail[0]) << 0 k1 &*= c1 k1 = Common.rotl(k1, r: 15) k1 &*= c2 h1 ^= k1 - + default: break } - - + + /** * finalization */ @@ -219,29 +219,29 @@ extension MurmurHash3.x86_128 { h2 ^= UInt32(len) h3 ^= UInt32(len) h4 ^= UInt32(len) - + h1 &+= h2 h1 &+= h3 h1 &+= h4 h2 &+= h1 h3 &+= h1 h4 &+= h1 - + h1 = Common.fmix32(h1) h2 = Common.fmix32(h2) h3 = Common.fmix32(h3) h4 = Common.fmix32(h4) - + h1 &+= h2 h1 &+= h3 h1 &+= h4 h2 &+= h1 h3 &+= h1 h4 &+= h1 - + return [h1, h2, h3, h4] } - + } @@ -318,7 +318,7 @@ extension MurmurHash3.x86_128 { // MARK: - Digest(Streaming) extension MurmurHash3.x86_128 { - + /// Reset current streaming state to initial. public func reset() { state = MurmurHash3.x86_128.State() @@ -356,7 +356,7 @@ extension MurmurHash3.x86_128 { // fill in tmp buffer state.memSize = array2.count % 16 state.mem.replaceSubrange(0.. UInt32 { var k1: UInt32 = 0 var h2 = h1 @@ -228,7 +228,7 @@ extension MurmurHash3.x86_32 { // fill in tmp buffer state.memSize = array2.count % 4 state.mem.replaceSubrange(0.. data.count { @@ -39,7 +39,7 @@ class Common { let data2 = data[index..= data.count { break @@ -87,7 +87,7 @@ class Common { let data2 = data[index..= data.count { break @@ -141,5 +141,5 @@ class Common { print("x64_128Hex(file -> 0x\(mmh.digestHex())") print("x64_128Hex(file, seed: 0x7fffffff) -> 0x\(mmh2.digestHex())") } - + } diff --git a/demo/MurmurHashDemoMacOS/MurmurHashDemoMacOS/AppDelegate.swift b/demo/MurmurHashDemoMacOS/MurmurHashDemoMacOS/AppDelegate.swift index ea4b4dd..7386818 100644 --- a/demo/MurmurHashDemoMacOS/MurmurHashDemoMacOS/AppDelegate.swift +++ b/demo/MurmurHashDemoMacOS/MurmurHashDemoMacOS/AppDelegate.swift @@ -10,17 +10,17 @@ import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { - - - + + + func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize your application } - + func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your application } - - + + } diff --git a/demo/MurmurHashDemoMacOS/MurmurHashDemoMacOS/ViewController.swift b/demo/MurmurHashDemoMacOS/MurmurHashDemoMacOS/ViewController.swift index 97e23ef..691ab5e 100644 --- a/demo/MurmurHashDemoMacOS/MurmurHashDemoMacOS/ViewController.swift +++ b/demo/MurmurHashDemoMacOS/MurmurHashDemoMacOS/ViewController.swift @@ -9,25 +9,25 @@ import Cocoa class ViewController: NSViewController { - + override func viewDidLoad() { super.viewDidLoad() - + Common.x86_32() Common.x86_32_file() - + Common.x86_128() Common.x86_128_file() - + Common.x64_128() Common.x64_128_file() } - + override var representedObject: Any? { didSet { - // Update the view, if already loaded. + // Update the view, if already loaded. } } - + } diff --git a/demo/MurmurHashDemoTvOS/MurmurHashDemoTvOS/AppDelegate.swift b/demo/MurmurHashDemoTvOS/MurmurHashDemoTvOS/AppDelegate.swift index d4c40ca..c2e0ff2 100644 --- a/demo/MurmurHashDemoTvOS/MurmurHashDemoTvOS/AppDelegate.swift +++ b/demo/MurmurHashDemoTvOS/MurmurHashDemoTvOS/AppDelegate.swift @@ -10,37 +10,37 @@ import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { - + var window: UIWindow? - - + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } - + func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } - + func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - + func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } - + func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - + func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } - - + + } diff --git a/demo/MurmurHashDemoTvOS/MurmurHashDemoTvOS/ViewController.swift b/demo/MurmurHashDemoTvOS/MurmurHashDemoTvOS/ViewController.swift index 269bfef..c90206e 100644 --- a/demo/MurmurHashDemoTvOS/MurmurHashDemoTvOS/ViewController.swift +++ b/demo/MurmurHashDemoTvOS/MurmurHashDemoTvOS/ViewController.swift @@ -11,10 +11,10 @@ import UIKit import MurmurHash_Swift class ViewController: UIViewController { - + override func viewDidLoad() { super.viewDidLoad() - + Common.x86_32() Common.x86_32_file() diff --git a/demo/MurmurHashDemoiOS/MurmurHashDemoiOS/AppDelegate.swift b/demo/MurmurHashDemoiOS/MurmurHashDemoiOS/AppDelegate.swift index 27198c1..974e52e 100644 --- a/demo/MurmurHashDemoiOS/MurmurHashDemoiOS/AppDelegate.swift +++ b/demo/MurmurHashDemoiOS/MurmurHashDemoiOS/AppDelegate.swift @@ -10,37 +10,37 @@ import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { - + var window: UIWindow? - - + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } - + func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. } - + func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - + func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } - + func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - + func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } - - + + } diff --git a/demo/MurmurHashDemoiOS/MurmurHashDemoiOS/ViewController.swift b/demo/MurmurHashDemoiOS/MurmurHashDemoiOS/ViewController.swift index 0a3b2b4..fe2e551 100644 --- a/demo/MurmurHashDemoiOS/MurmurHashDemoiOS/ViewController.swift +++ b/demo/MurmurHashDemoiOS/MurmurHashDemoiOS/ViewController.swift @@ -11,10 +11,10 @@ import UIKit import MurmurHash_Swift class ViewController: UIViewController { - + override func viewDidLoad() { super.viewDidLoad() - + Common.x86_32() Common.x86_32_file() @@ -24,5 +24,5 @@ class ViewController: UIViewController { Common.x64_128() Common.x64_128_file() } - + }