]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
* macros.h (FOR_BLOCKS): New macro, taken from lsh.
authorNiels Möller <nisse@lysator.liu.se>
Sat, 16 Jun 2001 22:27:37 +0000 (00:27 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Sat, 16 Jun 2001 22:27:37 +0000 (00:27 +0200)
Rev: src/nettle/macros.h:1.2

macros.h

index 7aa85d183c65e96e2f727298fae722107b6f9784..6b3d1b63e2f06805f48ec975f3b38ae4cc236385 100644 (file)
--- a/macros.h
+++ b/macros.h
@@ -55,5 +55,11 @@ do {                                         \
   (p)[0] = (i) & 0xff;                         \
 } while(0)
 
+/* Macro to make it easier to loop over several blocks. */
+#define FOR_BLOCKS(length, dst, src, blocksize)        \
+  assert( !((length) % (blocksize)));           \
+  for (; (length); ((length) -= (blocksize),   \
+                 (dst) += (blocksize),         \
+                 (src) += (blocksize)) )
 
 #endif /* NETTLE_MACROS_H_INCLUDED */