From 64824124cd2ab5e5550241866efe6e4aa1079074 Mon Sep 17 00:00:00 2001 From: Daniel Papenburg Date: Mon, 8 Jun 2020 08:14:24 -0500 Subject: [PATCH] Added days, weeks, years. Rehashed. --- src/PhysicalUnitDefinitions.cpp | 6 +++++- src/hash.cpp | 17 ++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/PhysicalUnitDefinitions.cpp b/src/PhysicalUnitDefinitions.cpp index 3cebea9..996f63a 100644 --- a/src/PhysicalUnitDefinitions.cpp +++ b/src/PhysicalUnitDefinitions.cpp @@ -148,10 +148,14 @@ DEFINE_CONST_ARRAY(PhysicalQuantity::UnitDefinition, PhysicalQuantity::KnownUnit // Ma Di Ti Te Cu // Time -{UN("s", "second","seconds"),1, {0,0,1,0,0}}, //, NOPREFIX}, +{UN("s", "second","seconds"),1, {0,0,1,0,0}}, {UN("min", "minute","minutes"),60, {0,0,1,0,0}, NOPREFIX}, {UN("hr", "hour","hours"),3600, {0,0,1,0,0}, NOPREFIX}, {UN("h", "hour","hours"),3600, {0,0,1,0,0}, NOPREFIX}, +{UN("d", "day","days"),3600*24, {0,0,1,0,0}, NOPREFIX}, +{UN("w", "week","weeks"),3600*24*7, {0,0,1,0,0}, NOPREFIX | EXPLICIT}, +{UN("y", "year","years"),3600*24*365.25, {0,0,1,0,0}, NOPREFIX}, + {UN("Hz", "hertz","hertz"),1, {0,0,-1,0,0}}, // TODO: Angle flag diff --git a/src/hash.cpp b/src/hash.cpp index f55cbfa..fc3743e 100644 --- a/src/hash.cpp +++ b/src/hash.cpp @@ -15,14 +15,17 @@ typedef PhysicalQuantity::CSubString csubstr; const size_t PhysicalQuantity::defaultHashSeed = 8; #ifdef PQ_GENCODE -const int PhysicalQuantity::default_hashTableSize_UnitSymbols = 233; -const int PhysicalQuantity::defaultHashSeed_UnitSymbols = 18; -const int PhysicalQuantity::default_hashTableSize_UnitLongNames = 80; -const int PhysicalQuantity::defaultHashSeed_UnitLongNames = 202; -const int PhysicalQuantity::default_hashTableSize_UnitPlurals = 123; -const int PhysicalQuantity::defaultHashSeed_UnitPlurals = 85; +const int PhysicalQuantity::default_hashTableSize_UnitSymbols = 110; +const int PhysicalQuantity::defaultHashSeed_UnitSymbols = 229; + +const int PhysicalQuantity::default_hashTableSize_UnitLongNames = 108; +const int PhysicalQuantity::defaultHashSeed_UnitLongNames = 181; + +const int PhysicalQuantity::default_hashTableSize_UnitPlurals = 117; +const int PhysicalQuantity::defaultHashSeed_UnitPlurals = 177; + const int PhysicalQuantity::default_hashTableSize_PrefixSymbols = 14; -const int PhysicalQuantity::defaultHashSeed_PrefixSymbols = 6; +const int PhysicalQuantity::defaultHashSeed_PrefixSymbols = 2; #endif