mirror of https://github.com/davisking/dlib.git
Added an implicit conversion to unsigned long for extracting the checksum
of crc32 objects.
This commit is contained in:
parent
ff451abbdf
commit
cd9c5709d4
|
@ -55,6 +55,9 @@ namespace dlib
|
|||
const std::vector<char>& item
|
||||
);
|
||||
|
||||
inline operator unsigned long (
|
||||
) const { return get_checksum(); }
|
||||
|
||||
inline unsigned long get_checksum (
|
||||
) const;
|
||||
|
||||
|
|
|
@ -101,6 +101,13 @@ namespace dlib
|
|||
- returns the current checksum
|
||||
!*/
|
||||
|
||||
operator unsigned long (
|
||||
) const;
|
||||
/*!
|
||||
ensures
|
||||
- returns get_checksum()
|
||||
!*/
|
||||
|
||||
void swap (
|
||||
crc32& item
|
||||
);
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace
|
|||
std::vector<char> buf;
|
||||
for (int i = 0; i < 4000; ++i)
|
||||
buf.push_back(i);
|
||||
DLIB_TEST(crc32(buf).get_checksum() == 492662731);
|
||||
DLIB_TEST(crc32(buf) == 492662731);
|
||||
}
|
||||
} a;
|
||||
|
||||
|
|
Loading…
Reference in New Issue