summaryrefslogtreecommitdiff
path: root/source/core/int-set.h
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-07-06 11:11:01 -0700
committerTim Foley <tfoley@nvidia.com>2017-07-06 11:18:09 -0700
commit03de737f0d18526b99b59a1810c7e290b66f4be2 (patch)
treed0e75b2524d9b7e666de0ca9fa13f3a086bf02dc /source/core/int-set.h
parent21a14cb4e0d578bc4f8a460016269a1199cac0da (diff)
Fix many warnings-as-errors issues.
The code should now compile cleanly with warnings as errors for VS2015 with `W3`. Most of the changes had to do with propagating a real pointer-sized integer type through code that had been using `int`.
Diffstat (limited to 'source/core/int-set.h')
-rw-r--r--source/core/int-set.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/source/core/int-set.h b/source/core/int-set.h
index a56a58d64..6b6f5e7a8 100644
--- a/source/core/int-set.h
+++ b/source/core/int-set.h
@@ -46,7 +46,7 @@ namespace Slang
{
SetMax(maxVal);
}
- int Size() const
+ UInt Size() const
{
return buffer.Count()*32;
}
@@ -57,40 +57,40 @@ namespace Slang
}
void SetAll()
{
- for (int i = 0; i<buffer.Count(); i++)
+ for (UInt i = 0; i<buffer.Count(); i++)
buffer[i] = 0xFFFFFFFF;
}
- void Resize(int size)
+ void Resize(UInt size)
{
- int oldBufferSize = buffer.Count();
+ UInt oldBufferSize = buffer.Count();
buffer.SetSize((size+31)>>5);
if (buffer.Count() > oldBufferSize)
memset(buffer.Buffer()+oldBufferSize, 0, (buffer.Count()-oldBufferSize) * sizeof(int));
}
void Clear()
{
- for (int i = 0; i<buffer.Count(); i++)
+ for (UInt i = 0; i<buffer.Count(); i++)
buffer[i] = 0;
}
- void Add(int val)
+ void Add(UInt val)
{
- int id = val>>5;
+ UInt id = val>>5;
if (id < buffer.Count())
buffer[id] |= (1<<(val&31));
else
{
- int oldSize = buffer.Count();
+ UInt oldSize = buffer.Count();
buffer.SetSize(id+1);
memset(buffer.Buffer() + oldSize, 0, (buffer.Count()-oldSize)*sizeof(int));
buffer[id] |= (1<<(val&31));
}
}
- void Remove(int val)
+ void Remove(UInt val)
{
if ((val>>5) < buffer.Count())
buffer[(val>>5)] &= ~(1<<(val&31));
}
- bool Contains(int val) const
+ bool Contains(UInt val) const
{
if ((val>>5) >= buffer.Count())
return false;
@@ -98,7 +98,7 @@ namespace Slang
}
void UnionWith(const IntSet & set)
{
- for (int i = 0; i<Math::Min(set.buffer.Count(), buffer.Count()); i++)
+ for (UInt i = 0; i<Math::Min(set.buffer.Count(), buffer.Count()); i++)
{
buffer[i] |= set.buffer[i];
}
@@ -109,7 +109,7 @@ namespace Slang
{
if (buffer.Count() != set.buffer.Count())
return false;
- for (int i = 0; i<buffer.Count(); i++)
+ for (UInt i = 0; i<buffer.Count(); i++)
if (buffer[i] != set.buffer[i])
return false;
return true;
@@ -122,7 +122,7 @@ namespace Slang
{
if (set.buffer.Count() < buffer.Count())
memset(buffer.Buffer() + set.buffer.Count(), 0, (buffer.Count()-set.buffer.Count())*sizeof(int));
- for (int i = 0; i<Math::Min(set.buffer.Count(), buffer.Count()); i++)
+ for (UInt i = 0; i<Math::Min(set.buffer.Count(), buffer.Count()); i++)
{
buffer[i] &= set.buffer[i];
}
@@ -131,26 +131,26 @@ namespace Slang
{
rs.buffer.SetSize(Math::Max(set1.buffer.Count(), set2.buffer.Count()));
rs.Clear();
- for (int i = 0; i<set1.buffer.Count(); i++)
+ for (UInt i = 0; i<set1.buffer.Count(); i++)
rs.buffer[i] |= set1.buffer[i];
- for (int i = 0; i<set2.buffer.Count(); i++)
+ for (UInt i = 0; i<set2.buffer.Count(); i++)
rs.buffer[i] |= set2.buffer[i];
}
static void Intersect(IntSet & rs, const IntSet & set1, const IntSet & set2)
{
rs.buffer.SetSize(Math::Min(set1.buffer.Count(), set2.buffer.Count()));
- for (int i = 0; i<rs.buffer.Count(); i++)
+ for (UInt i = 0; i<rs.buffer.Count(); i++)
rs.buffer[i] = set1.buffer[i] & set2.buffer[i];
}
static void Subtract(IntSet & rs, const IntSet & set1, const IntSet & set2)
{
rs.buffer.SetSize(set1.buffer.Count());
- for (int i = 0; i<Math::Min(set1.buffer.Count(), set2.buffer.Count()); i++)
+ for (UInt i = 0; i<Math::Min(set1.buffer.Count(), set2.buffer.Count()); i++)
rs.buffer[i] = set1.buffer[i] & (~set2.buffer[i]);
}
static bool HasIntersection(const IntSet & set1, const IntSet & set2)
{
- for (int i = 0; i<Math::Min(set1.buffer.Count(), set2.buffer.Count()); i++)
+ for (UInt i = 0; i<Math::Min(set1.buffer.Count(), set2.buffer.Count()); i++)
{
if (set1.buffer[i] & set2.buffer[i])
return true;