summaryrefslogtreecommitdiff
path: root/libs/ardour/port_set.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-06-29 06:58:07 +0000
committerDavid Robillard <d@drobilla.net>2007-06-29 06:58:07 +0000
commiteb296b2c957f574334fae2aefd8b863cf7631769 (patch)
tree57a546f8c61a81b7088b23b9fcd92a5b9d578e9f /libs/ardour/port_set.cc
parent44867662a3d020e042714d1c5e948b8c3afea941 (diff)
Reduce overhead of multi-type-ness (last Summer's SoC):
Use uint32_t instead of size_t counts (halves size of ChanCount on 64-bit). Shift DataType values down to eliminate subtraction every index of a ChanCount or *Set. Allow using DataType directly as an array index (prettier/terser). Fix some mixed spaces/tabs in file comment headers. git-svn-id: svn://localhost/ardour2/trunk@2082 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/port_set.cc')
-rw-r--r--libs/ardour/port_set.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/libs/ardour/port_set.cc b/libs/ardour/port_set.cc
index 388162359b..3182c2b959 100644
--- a/libs/ardour/port_set.cc
+++ b/libs/ardour/port_set.cc
@@ -34,17 +34,14 @@ static bool sort_ports_by_name (Port* a, Port* b)
void
PortSet::add(Port* port)
{
- const size_t list_index = port->type().to_index();
- assert(list_index < _ports.size());
-
- PortVec& v = _ports[list_index];
+ PortVec& v = _ports[port->type()];
v.push_back(port);
sort(v.begin(), v.end(), sort_ports_by_name);
_count.set(port->type(), _count.get(port->type()) + 1);
- assert(_count.get(port->type()) == _ports[port->type().to_index()].size());
+ assert(_count.get(port->type()) == _ports[port->type()].size());
}
bool
@@ -108,7 +105,7 @@ PortSet::port(DataType type, size_t n) const
if (type == DataType::NIL) {
return port(n);
} else {
- const PortVec& v = _ports[type.to_index()];
+ const PortVec& v = _ports[type];
assert(n < v.size());
return v[n];
}