Skip to content

Commit 2f43dde

Browse files
Consisting of stylistic (favoring pre-increment over post-) and comment / typo changes, this is inching closer to being the FINAL commit for the "old-style" (aka "V2") version of RMs.
1 parent 234b679 commit 2f43dde

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

RMsCore.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,11 @@ void rms_publish_string(std::string_view tag, std::string_view data) noexcept(fa
357357
dumpExported("rms_publish_string('{}','{:.8}...')...()\n", tag, data);
358358
if (tag.empty())
359359
return; // we're OUTTA here!
360-
// N.B. - limit any data to 0 <= strlen(data) <= 4095!
360+
// N.B. - limit any data to 0 <= strlen(data) <= 4096!
361361
if (data.size() > 4096)
362362
throw invalid_argument(string("rms_publish_string passed invalid length ") + to_string(data.size()));
363363
dumpExported("rms_publish_string('{}'...)...Distribute()\n", tag);
364-
rmsRoot->Distribute(tag, data.data(), (int)data.size());
364+
rmsRoot->Distribute(tag, data.data(), data.size());
365365
}
366366

367367
RMS_EXPORT
@@ -609,7 +609,7 @@ int RMsRoot::CheckQueue(int pg) const
609609
lock_guard<rms::RSpinLockEx> acquire(remove_const_t<rms::RSpinLockEx>(spin));
610610
for (auto q = queueHead; q; q = ((RMsQueue*)pg2xp(q))->next)
611611
if (q == pg)
612-
n++;
612+
++n;
613613
if (!n)
614614
dumpCheck("RMsRoot::CheckQueue({})... is BOGUS (NOT found)\n", pg);
615615
else if (n > 1)
@@ -738,7 +738,7 @@ RMsQueue::~RMsQueue()
738738
rmsRoot->RemoveQueue(pg);
739739
Flush();
740740
dumpQueue("<{}>::~RMsQueue()...freeing {} indirect pages\n", pg, remove_volatile_t<int>(pages));
741-
for (auto i = 0; i < pages; i++)
741+
for (auto i = 0; i < pages; ++i)
742742
rmsRoot->FreePage(pageE[i]);
743743
rmsRoot->FreeRP(pattern);
744744
rmsRoot->FreePage(pg);
@@ -792,7 +792,7 @@ void RMsQueue::append(rms_ptr_t tag, rms_ptr_t data)
792792
return rmsRoot->FreePair(td); // early out; "signaled"
793793
if (const auto [status, pg, pi] = checkWrite(); status)
794794
(write < NQuick ? quickE[write] : ((pq_pag_t*)pg2xp(pg))->pqTD[pi]) = td,
795-
write++, semaphore.signal();
795+
++write, semaphore.signal();
796796
else
797797
rmsRoot->FreePair(td);
798798
dumpQueue("<{}>::append({:x}:{:x})...{}\n", xp2pg(this), tag, data, remove_volatile_t<int>(write));
@@ -867,7 +867,7 @@ void RMsQueue::Flush()
867867
while (read < write)
868868
rmsRoot->FreePair(read < NQuick ?
869869
quickE[read] :
870-
((pq_pag_t*)pg2xp(pageE[qp2pq(read)]))->pqTD[qp2pi(read)]), read++;
870+
((pq_pag_t*)pg2xp(pageE[qp2pq(read)]))->pqTD[qp2pi(read)]), ++read;
871871
read = 0, write = 0, state = 0;
872872
}
873873

rms.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ void initialize(int np);
507507
class publisher {
508508
public:
509509
// publish "tag/data pair" to any subscription queues with matching patterns
510-
static void put_with_tag(std::string_view d, std::string_view t) { rms_publish_bytes(t, (const unsigned char*)d.data(), (int)d.size()); }
510+
static void put_with_tag(std::string_view d, std::string_view t) { rms_publish_string(t, d); }
511511
static void put_with_tag(const unsigned char* d, size_t n, std::string_view t) { rms_publish_bytes(t, d, n); }
512512
static void put_with_tag(rms_ieee d, std::string_view t) { rms_publish_ieee(t, d); }
513513
static void put_with_tag(rms_int32 d, std::string_view t) { rms_publish_int32(t, d); }

t1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ int main(int argc, char* argv[])
7878
const auto t1 = high_resolution_clock::now();
7979
rms_close(id);
8080
printf("timing for %d Publish/Wait pairs = %g ns/round-trip\n", Iterations * Transactions,
81-
(duration_cast<microseconds>(t1 - t0).count() / (double(Iterations) * Transactions / 1000)));
81+
(duration_cast<nanoseconds>(t1 - t0).count() / (double(Iterations) * Transactions)));
8282
return 0;
8383
}

t2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ int main(int argc, char* argv[])
6161
}
6262
const auto t1 = high_resolution_clock::now();
6363
cout << "timing for " << Iterations * Transactions << " Publish/Wait pairs = "
64-
<< (duration_cast<microseconds>(t1 - t0).count() / (double(Iterations) * Transactions / 1000)) << " ns/round-trip" << endl;
64+
<< (duration_cast<nanoseconds>(t1 - t0).count() / (double(Iterations) * Transactions)) << " ns/round-trip" << endl;
6565
return 0;
6666
}

t3.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ int main(int argc, char* argv[])
6464
}
6565
const auto t1 = high_resolution_clock::now();
6666
cout << "timing for " << Iterations * Transactions << " Publish/Wait pairs = "
67-
<< (duration_cast<microseconds>(t1 - t0).count() / (double(Iterations) * Transactions / 1000)) << " ns/round-trip" << endl;
67+
<< (duration_cast<nanoseconds>(t1 - t0).count() / (double(Iterations) * Transactions)) << " ns/round-trip" << endl;
6868
// now for some exciting multi-threaded tests...
6969
// ... first, create a thread watching our queue
7070
std::thread t([&]() {

0 commit comments

Comments
 (0)