X-Git-Url: https://www.flypig.org.uk/git/?p=libcontrac.git;a=blobdiff_plain;f=include%2Fcontrac%2Futils.h;fp=include%2Fcontrac%2Futils.h;h=38b0c3f4bd041a7c6175533e3f8743080e4187cd;hp=0000000000000000000000000000000000000000;hb=8515bbba069347de07a452586d7e49a2e8bdf151;hpb=79942abab927241b65a29a8a30d71b8efe6b6d94 diff --git a/include/contrac/utils.h b/include/contrac/utils.h new file mode 100644 index 0000000..38b0c3f --- /dev/null +++ b/include/contrac/utils.h @@ -0,0 +1,51 @@ +/** \ingroup contrac + * @file + * @author David Llewellyn-Jones + * @version $(VERSION) + * + * @section LICENSE + * + * + * + * @brief + * @section DESCRIPTION + * + * + * + */ + + +#ifndef __UTILS_H +#define __UTILS_H + +// Includes + +// Defines + +#define MAX(a,b) \ + ({ __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + _a > _b ? _a : _b; }) + +#define MIN(a,b) \ + ({ __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + _a < _b ? _a : _b; }) + +// Structures + +// Function prototypes + +size_t base64_encode_size(size_t binary_input); +size_t base64_decode_size(size_t base64_input); +void base64_encode_binary_to_base64(unsigned char const *input, size_t input_size, unsigned char *output, size_t *output_size); +void base64_decode_base64_to_binary(unsigned char const *input, size_t input_size, unsigned char *output, size_t *output_size); + +// Function definitions + +#endif // __UTILS_H + + + + +