summaryrefslogtreecommitdiff
path: root/src/jit/tinyarray.h
diff options
context:
space:
mode:
authorMichelle McDaniel <adiaaida@gmail.com>2016-08-09 13:15:05 -0700
committerMichelle McDaniel <adiaaida@gmail.com>2016-08-11 09:53:41 -0700
commit36a2b906c008cd3693a9ab5aef7b4402addd6c74 (patch)
tree27333c6f26304490169825ae1c17484534246dc6 /src/jit/tinyarray.h
parentab7d6a8df73d3d89210a778338feaa9fedf4146a (diff)
downloadcoreclr-36a2b906c008cd3693a9ab5aef7b4402addd6c74.tar.gz
coreclr-36a2b906c008cd3693a9ab5aef7b4402addd6c74.tar.bz2
coreclr-36a2b906c008cd3693a9ab5aef7b4402addd6c74.zip
Reformat jit sources with clang-tidy and format
This change is the result of running clang-tidy and clang-format on jit sources.
Diffstat (limited to 'src/jit/tinyarray.h')
-rw-r--r--src/jit/tinyarray.h42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/jit/tinyarray.h b/src/jit/tinyarray.h
index 33f1ba4886..17d7e044b2 100644
--- a/src/jit/tinyarray.h
+++ b/src/jit/tinyarray.h
@@ -11,13 +11,13 @@
// storagetype is the type (integral) which your array is going to be packed into
// itemtype is the type of array elements
// bits_per_element is size of the elements in bits
-template<class storageType, class itemType, int bits_per_element>
+template <class storageType, class itemType, int bits_per_element>
class TinyArray
{
public:
// operator[] returns a 'ref' (usually a ref to the element type)
- // This presents a problem if you wanted to implement something like a
- // bitvector via this packed array, because you cannot make a ref to
+ // This presents a problem if you wanted to implement something like a
+ // bitvector via this packed array, because you cannot make a ref to
// the element type.
// The trick is you define something that acts like a ref (TinyArrayRef in this case)
// which for our purposes means you can assign to and from it and our chosen
@@ -26,19 +26,19 @@ public:
{
public:
// this is really the getter for the array.
- operator itemType()
+ operator itemType()
{
- storageType mask = ((1 << bits_per_element) - 1);
- int shift = bits_per_element * index;
+ storageType mask = ((1 << bits_per_element) - 1);
+ int shift = bits_per_element * index;
itemType result = (itemType)((*data >> shift) & mask);
return result;
}
- void operator =(const itemType b)
+ void operator=(const itemType b)
{
storageType mask = ((1 << bits_per_element) - 1);
- assert(itemType(b&mask) == b);
+ assert(itemType(b & mask) == b);
mask <<= bits_per_element * index;
@@ -46,28 +46,32 @@ public:
*data |= b << (bits_per_element * index);
}
friend class TinyArray;
+
protected:
- TinyArrayRef(storageType *d, int idx) : data(d), index(idx) {}
+ TinyArrayRef(storageType* d, int idx) : data(d), index(idx)
+ {
+ }
- storageType *data;
- int index;
-
+ storageType* data;
+ int index;
};
-
storageType data;
- void clear() { data = 0; }
+ void clear()
+ {
+ data = 0;
+ }
- TinyArrayRef operator [](unsigned int n)
+ TinyArrayRef operator[](unsigned int n)
{
- assert((n+1) * bits_per_element <= sizeof(itemType) * 8);
+ assert((n + 1) * bits_per_element <= sizeof(itemType) * 8);
return TinyArrayRef(&data, n);
}
- // only use this for clearing it
- void operator=(void *rhs)
+ // only use this for clearing it
+ void operator=(void* rhs)
{
- assert(rhs==NULL);
+ assert(rhs == NULL);
data = 0;
}
};