ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Represent/Hexadecimal.cpp
(Generate patch)

Comparing Represent/Hexadecimal.cpp (file contents):
Revision 373 by douglas, 2004-12-22T17:27:28-08:00 vs.
Revision 398 by douglas, 2004-12-27T14:43:01-08:00

# Line 6 | Line 6
6  
7   #include "Hexadecimal.hpp"
8  
9 inline byte_t Hexadecimal::hex(const ext::CodePoint& atom)
10 {
11        if (atom >= '0' && atom <= '9') return atom - '0'; else if (atom >= 'a' && atom <= 'f') return atom - 'a' + 0xA; else if (atom >= 'A' && atom <= 'F') return atom - 'A' + 0xA; else return 0;
12 }
13
9   Hexadecimal::Hexadecimal(const ext::String& string, bool signed_) : Binary(string.GetSize() / 2, 0)
10   {
11          if (string.IsEmpty())
# Line 29 | Line 24 | Hexadecimal::Hexadecimal(const ext::Stri
24                  bytes.InsertLast(0);
25  
26                  bytes.Last() |= hex(string[0]);
27 <                bytes.Last() |= signed_ && bytes.Last() < 8 ? 0xF0 : 0;
27 >                bytes.Last() |= signed_ && bytes.Last() > 7 ? 0xF0 : 0;
28          }
29   }
30  
# Line 48 | Line 43 | Hexadecimal::operator ext::String() cons
43  
44          return string;
45   }
46 +
47 + inline byte_t Hexadecimal::hex(const ext::CodePoint& atom)
48 + {
49 +        if (atom >= '0' && atom <= '9') return atom - '0'; else if (atom >= 'a' && atom <= 'f') return atom - 'a' + 0xA; else if (atom >= 'A' && atom <= 'F') return atom - 'A' + 0xA; else return 0;
50 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines