wasSharp – Diff between revs 23 and 27

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 23 Rev 27
1 /////////////////////////////////////////////////////////////////////////// 1 ///////////////////////////////////////////////////////////////////////////
2 // Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // 2 // Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 //
3 // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // 3 // Please see: http://www.gnu.org/licenses/gpl.html for legal details, //
4 // rights of fair usage, the disclaimer and warranty conditions. // 4 // rights of fair usage, the disclaimer and warranty conditions. //
5 /////////////////////////////////////////////////////////////////////////// 5 ///////////////////////////////////////////////////////////////////////////
6   6  
7 using System.Collections.Generic; 7 using System.Collections.Generic;
8   8  
9 namespace wasSharp 9 namespace wasSharp
10 { 10 {
11 public struct NetHash 11 public struct NetHash
12 { 12 {
13 private readonly int hashCode; 13 private readonly int hashCode;
14   14  
15 public NetHash(int hashCode = 17) 15 public NetHash(int hashCode = 17)
16 { 16 {
17 this.hashCode = hashCode; 17 this.hashCode = hashCode;
18 } 18 }
19   19  
20 public static NetHash Init => new NetHash(); 20 public static NetHash Init => new NetHash();
21   21  
22 public static implicit operator int(NetHash hashCode) 22 public static implicit operator int(NetHash hashCode)
23 { 23 {
24 return hashCode.GetHashCode(); 24 return hashCode.GetHashCode();
25 } 25 }
26   26  
27 public NetHash Hash<T>(T obj) 27 public NetHash Hash<T>(T obj)
28 { 28 {
29 var c = EqualityComparer<T>.Default; 29 var c = EqualityComparer<T>.Default;
30 var h = c.Equals(obj, default(T)) ? 0 : obj.GetHashCode(); 30 var h = c.Equals(obj, default(T)) ? 0 : obj.GetHashCode();
31 unchecked 31 unchecked
32 { 32 {
33 h += hashCode*31; 33 h += hashCode * 31;
34 } 34 }
35 return new NetHash(h); 35 return new NetHash(h);
36 } 36 }
37   37  
38 public override int GetHashCode() 38 public override int GetHashCode()
39 { 39 {
40 return hashCode; 40 return hashCode;
41 } 41 }
42 } 42 }
43 } -  
44   43 }
-   44  
45
Generated by GNU Enscript 1.6.5.90.
-  
46   -  
47   -  
48   -