aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/base/buf_comp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/base/buf_comp.h')
-rw-r--r--src/lib/base/buf_comp.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/lib/base/buf_comp.h b/src/lib/base/buf_comp.h
index a6cc84ba3..e1971c458 100644
--- a/src/lib/base/buf_comp.h
+++ b/src/lib/base/buf_comp.h
@@ -57,11 +57,20 @@ class BOTAN_PUBLIC_API(2,0) Buffered_Computation
*/
template<typename T> void update_be(const T in)
{
- for(size_t i = 0; i != sizeof(T); ++i)
- {
- uint8_t b = get_byte(i, in);
- add_data(&b, 1);
- }
+ uint8_t inb[sizeof(T)];
+ store_be(in, inb);
+ add_data(inb, sizeof(inb));
+ }
+
+ /**
+ * Add an integer in little-endian order
+ * @param in the value
+ */
+ template<typename T> void update_le(const T in)
+ {
+ uint8_t inb[sizeof(T)];
+ store_le(in, inb);
+ add_data(inb, sizeof(inb));
}
/**