From 5e1a4e8676d9026bf5377233cb52d62901d7fe2c Mon Sep 17 00:00:00 2001 From: cxl Date: Wed, 27 Feb 2013 20:07:22 +0000 Subject: [PATCH] .docs git-svn-id: svn://ultimatepp.org/upp/trunk@5867 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Hash.cpp | 4 ++-- uppsrc/Core/Other.h | 2 +- uppsrc/Core/src.tpp/Bits$en-us.tpp | 38 ++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 uppsrc/Core/src.tpp/Bits$en-us.tpp diff --git a/uppsrc/Core/Hash.cpp b/uppsrc/Core/Hash.cpp index 28787ee3c..d0103b5dc 100644 --- a/uppsrc/Core/Hash.cpp +++ b/uppsrc/Core/Hash.cpp @@ -345,7 +345,7 @@ void Bits::Set(int i, bool b) ASSERT(i >= 0 && alloc >= 0); int q = i >> 5; if(q >= alloc) { - int nalloc = 2 * q + 1; + int nalloc = 4 * q / 3 + 1; dword *nbp = new dword[nalloc]; if(bp) { Copy(nbp, bp, bp + alloc); @@ -361,7 +361,7 @@ void Bits::Set(int i, bool b) } void Bits::Set(int i, bool b, int count) -{ //! Optimize !!! +{ while(count--) Set(i++, b); } diff --git a/uppsrc/Core/Other.h b/uppsrc/Core/Other.h index 88d2ac355..19dbe87fd 100644 --- a/uppsrc/Core/Other.h +++ b/uppsrc/Core/Other.h @@ -128,7 +128,7 @@ class Bits : Moveable { public: void Clear(); void Set(int i, bool b = true); - void Set(int i, bool b, int count); + void Set(int i, bool b, int count); // deprecated bool Get(int i) const { ASSERT(i >= 0 && alloc >= 0); int q = i >> 5; return q < alloc ? bp[q] & (1 << (i & 31)) : false; } bool operator[](int i) const { return Get(i); } diff --git a/uppsrc/Core/src.tpp/Bits$en-us.tpp b/uppsrc/Core/src.tpp/Bits$en-us.tpp new file mode 100644 index 000000000..677307b59 --- /dev/null +++ b/uppsrc/Core/src.tpp/Bits$en-us.tpp @@ -0,0 +1,38 @@ +topic "Bits"; +[2 $$0,0#00000000000000000000000000000000:Default] +[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class] +[l288;2 $$2,2#27521748481378242620020725143825:desc] +[0 $$3,0#96390100711032703541132217272105:end] +[H6;0 $$4,0#05600065144404261032431302351956:begin] +[i448;a25;kKO9;2 $$5,0#37138531426314131252341829483370:item] +[l288;a4;*@5;1 $$6,6#70004532496200323422659154056402:requirement] +[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param] +[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam] +[b42;2 $$9,9#13035079074754324216151401829390:normal] +[{_} +[ {{10000@(113.42.0) [s0;%% [*@7;4 Bits]]}}&] +[s0;%% &] +[s1;:Bits`:`:class: [@(0.0.255)3 class][3 _][*3 Bits][3 _:_][@(0.0.255)3 private][3 _][*@3;3 Moveabl +e][3 <][*3 Bits][3 >_]&] +[s2;%% Bits is a simple container class representing `"unlimited`" +array of bools, implemented using binary arrays, packing 8 bits +per byte of allocated space (plus some allocation reserve). It +is moveable type with pick transfer sematics.&] +[s0;i448;a25;kKO9;:noref:@(0.0.255) &] +[ {{10000F(128)G(128)@1 [s0;%% [* Public Method List]]}}&] +[s3; &] +[s5;:Bits`:`:Clear`(`): [@(0.0.255) void]_[* Clear]()&] +[s2;%% Sets all bools to false.&] +[s3; &] +[s4; &] +[s5;:Bits`:`:Set`(int`,bool`): [@(0.0.255) void]_[* Set]([@(0.0.255) int]_[*@3 i], +[@(0.0.255) bool]_[*@3 b]_`=_[@(0.0.255) true])&] +[s2;%% Sets bit [%-*@3 i] to [%-*@3 b] .&] +[s3;%% &] +[s4;%% &] +[s5;:Bits`:`:Get`(int`)const: [@(0.0.255) bool]_[* Get]([@(0.0.255) int]_[*@3 i])_[@(0.0.255) c +onst]&] +[s5;:Bits`:`:operator`[`]`(int`)const: [@(0.0.255) bool]_[* operator`[`]]([@(0.0.255) int]_ +[*@3 i])_[@(0.0.255) const]&] +[s2;%% Returns the value of bool [%-*@3 i].&] +[s0;%% ]] \ No newline at end of file