Commit Graph

2 Commits

Author SHA1 Message Date
Abtin Keshavarzian 75c525bac8 [array] select the index/length uint type based on array size (#6872)
This commit enhances the template `Array` class implementation to
allow the `uint` type used for array size (which is also used for
length and index) to be specified as a template type parameter. If
not explicitly specified, a default `uint` type is selected based on
the array size `kMaxSize`, i.e., if `kMaxSize <= 255` then `uint8_t`
will be used, otherwise `uint16_t` will be used.
2021-07-31 09:35:14 -07:00
Abtin Keshavarzian 44bf2f1818 [common] adding Array class (#6853)
This commit adds a generic `Array<Type, kMaxSize>` class which
represents a fixed size array of elements of template `Type` which
tracks its current length. Entries can be appended to the array
(`PushBack()`) and removed from the end of array (`PopBack()`). This
simple data model is used in some other modules, so having a generic
version can help simplify the code. This commit also adds a unit test
to verify `Array` methods.
2021-07-28 17:04:05 -07:00