@@ -17,102 +17,122 @@ public struct Bitmask : IEquatable<Bitmask>, IEquatable<int>
1717 [ HideInInspector ]
1818 private int mask ;
1919
20- /// <summary>Creates a new Bitmask from the given 32-bit integer.</summary>
20+ /// <summary>
21+ /// Creates a new Bitmask from the given 32-bit integer.
22+ /// </summary>
2123 /// <param name="mask">The 32-bit integer to represent as a bitmask.</param>
2224 public Bitmask ( int mask )
2325 {
2426 this . mask = mask ;
2527 }
2628
27- /// <returns >
28- /// True if the bitmask contains the <paramref name="flag"/>.
29+ /// <summary >
30+ /// Checks if the bitmask contains the <paramref name="flag"/>.
2931 /// <code>(mask & flag) == flag</code>
30- /// </returns >
32+ /// </summary >
3133 /// <param name="flag">The flag to check for.</param>
3234 public bool HasFlag ( int flag )
3335 {
3436 return ( this . mask & flag ) == flag ;
3537 }
3638
37- /// <returns >
38- /// True if the bitmask contains any of the <paramref name="flags"/>.
39+ /// <summary >
40+ /// Checks if the bitmask contains any of the <paramref name="flags"/>.
3941 /// <code>(mask & flags) != 0</code>
40- /// </returns >
42+ /// </summary >
4143 /// <param name="flags">The flags to check for.</param>
4244 public bool HasAnyFlag ( int flags )
4345 {
4446 return ( this . mask & flags ) != 0 ;
4547 }
4648
47- /// <returns >
48- /// True if the bitmask contains only the given <paramref name="flags"/>
49+ /// <summary >
50+ /// Checks if the bitmask contains only the given <paramref name="flags"/>
4951 /// and no other flags.
5052 /// <code>((mask ^ flags) & flags) == 0</code>
51- /// </returns >
53+ /// </summary >
5254 /// <param name="flags">The flags to check for.</param>
5355 public bool HasOnlyFlags ( int flags )
5456 {
5557 return ( ( this . mask ^ flags ) & flags ) == 0 ;
5658 }
5759
58- /// <returns>True if the nth bit of the bitmask is set.</returns>
60+ /// <summary>
61+ /// Checks if the nth bit of the bitmask is set.
62+ /// </summary>
5963 /// <param name="n">The nth bit to check for.</param>
6064 public bool Has ( int n )
6165 {
6266 return Get ( n ) != 0 ;
6367 }
6468
65- /// <returns>The nth bit of the bitmask.</returns>
69+ /// <summary>
70+ /// Returns the nth bit of the bitmask.
71+ /// </summary>
6672 /// <param name="n">The nth bit to get.</param>
6773 public int Get ( int n )
6874 {
6975 return ( this . mask >> n ) & 1 ;
7076 }
7177
72- /// <summary>Sets the nth bit of the bitmask to 1.</summary>
78+ /// <summary>
79+ /// Sets the nth bit of the bitmask to 1.
80+ /// </summary>
7381 /// <param name="n">The nth bit to set.</param>
7482 public void Set ( int n )
7583 {
7684 this . mask |= 1 << n ;
7785 }
7886
79- /// <summary>Sets the nth bit of the bitmask to 0.</summary>
87+ /// <summary>
88+ /// Sets the nth bit of the bitmask to 0.
89+ /// </summary>
8090 /// <param name="n">The nth bit to clear.</param>
8191 public void Clear ( int n )
8292 {
8393 this . mask &= ~ ( 1 << n ) ;
8494 }
8595
86- /// <summary>Toggles the nth bit of the bitmask.</summary>
96+ /// <summary>
97+ /// Toggles the nth bit of the bitmask.
98+ /// </summary>
8799 /// <param name="n">The nth bit to toggle.</param>
88100 public void Toggle ( int n )
89101 {
90102 this . mask ^= 1 << n ;
91103 }
92104
93- /// <summary>Sets the nth bit of the bitmask to x.</summary>
105+ /// <summary>
106+ /// Sets the nth bit of the bitmask to x.
107+ /// </summary>
94108 /// <param name="n">The nth bit to set.</param>
95109 /// <param name="x">The value to set the bit to.</param>
96110 public void Change ( int n , int x )
97111 {
98112 this . mask = ( this . mask & ~ ( 1 << n ) ) | ( x << n ) ;
99113 }
100114
101- /// <returns>True if the bitmask is equal to the <paramref name="other"/>.</returns>
115+ /// <summary>
116+ /// Determines if the bitmask is equal to <paramref name="other"/>.
117+ /// </summary>
102118 /// <param name="other">The bitmask to compare to.</param>
103119 public bool Equals ( Bitmask other )
104120 {
105121 return this . mask == other . mask ;
106122 }
107123
108- /// <returns>True if the bitmask is equal to the <paramref name="other"/>.</returns>
124+ /// <summary>
125+ /// Determines if the bitmask is equal to <paramref name="other"/>.
126+ /// </summary>
109127 /// <param name="other">The bitmask to compare to.</param>
110128 public bool Equals ( int other )
111129 {
112130 return this . mask == other ;
113131 }
114132
115- /// <returns>True if the bitmask is equal to the <paramref name="other"/>.</returns>
133+ /// <summary>
134+ /// Determines if the bitmask is equal to <paramref name="other"/>.
135+ /// </summary>
116136 /// <param name="other">The object to compare to.</param>
117137 public override bool Equals ( object other )
118138 {
@@ -125,17 +145,18 @@ public override bool Equals(object other)
125145 }
126146 }
127147
128- /// <returns >
129- /// The hash code of the bitmask.
130- /// </returns >
148+ /// <summary >
149+ /// Returns the hash code of the bitmask.
150+ /// </summary >
131151 public override int GetHashCode ( )
132152 {
133153 return this . mask . GetHashCode ( ) ;
134154 }
135155
136- /// <returns>
137- /// The string representation of the bitmask.
138- /// </returns>
156+ /// <summary>
157+ /// Converts the bitmask to a string.
158+ /// </summary>
159+ /// <returns>A string representation of the bitmask.</returns>
139160 public override string ToString ( )
140161 {
141162 string binary = System . Convert . ToString ( this . mask , 2 ) ;
0 commit comments