diff options
author | lloyd <[email protected]> | 2009-07-03 04:46:47 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-07-03 04:46:47 +0000 |
commit | e0555387e440c708294a3593c90d3066ae4a0a55 (patch) | |
tree | 1f81e36cd8a919d512acf9ffc61e785d48669177 /src/utils | |
parent | ce5cab439b617800f48c94ebaeeb7cd3bd786cfe (diff) | |
parent | d9fea92eecbad7863518bd07f2b80ead41494894 (diff) |
propagate from branch 'net.randombit.botan' (head d6d32791adfa878b6fc0dd3a5b65a665b7bbb549)
to branch 'net.randombit.botan.c++0x' (head 54deb0e078aab8cd91c8fd8819d1e6668fc762da)
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/data_src.cpp | 2 | ||||
-rw-r--r-- | src/utils/mem_ops.h | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/utils/data_src.cpp b/src/utils/data_src.cpp index 4164a6dd3..e6387c4ba 100644 --- a/src/utils/data_src.cpp +++ b/src/utils/data_src.cpp @@ -38,7 +38,7 @@ u32bit DataSource::discard_next(u32bit n) u32bit discarded = 0; byte dummy; for(u32bit j = 0; j != n; ++j) - discarded = read_byte(dummy); + discarded += read_byte(dummy); return discarded; } diff --git a/src/utils/mem_ops.h b/src/utils/mem_ops.h index f6557c744..0fcf34ba8 100644 --- a/src/utils/mem_ops.h +++ b/src/utils/mem_ops.h @@ -26,7 +26,14 @@ template<typename T> inline void set_mem(T* ptr, u32bit n, byte val) { std::memset(ptr, val, sizeof(T)*n); } template<typename T> inline bool same_mem(const T* p1, const T* p2, u32bit n) - { return (std::memcmp(p1, p2, sizeof(T)*n) == 0); } + { + bool is_same = true; + + for(u32bit i = 0; i != n; ++i) + is_same &= (p1[i] == p2[i]); + + return is_same; + } } |