From 0951c50e405a962d4961bb2ab5bff42abd526b9b Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 17 Jan 2023 20:14:32 -0500 Subject: [PATCH] Further explain. --- Numeric/NumericCoder.hpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Numeric/NumericCoder.hpp b/Numeric/NumericCoder.hpp index ab8d48ad8..368838c39 100644 --- a/Numeric/NumericCoder.hpp +++ b/Numeric/NumericCoder.hpp @@ -13,11 +13,21 @@ namespace Numeric { /// Stores and retrieves an arbitrary number of fields into an int with arbitrary modulos. /// -/// E.g. NumericEncoder<8, 3, 14> establishes an encoder and decoder for three fields, +/// E.g. NumericCoder<8, 3, 14> establishes an encoder and decoder for three fields, /// the first is modulo 8, the second is modulo 3, the third is modulo 14. /// -/// NumericEncoder<8, 3, 14>::encode<2>(v, 9) will mutate v so that the third field +/// NumericCoder<8, 3, 14>::encode<2>(v, 9) will mutate v so that the third field /// (i.e. field 2) has value 9. +/// +/// The first given field will occupy the least significant part of the target int; e.g. +/// a NumericCoder<3, 4, 6> with ::encode<0>(v, 2), ::encode<1>(v, 1) and +/// ::encode<2>(v, 5) will have a final value of: +/// +/// [value] 2 + +/// [value] 1 * [product of previous field sizes] 3 + +/// 5 * 12 +/// = 65 +/// template class NumericCoder { public: /// Modifies @c target to hold @c value at @c index.