X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=include%2Fecoli_utils.h;fp=include%2Fecoli_utils.h;h=5a141925e7fefebb0af5c6c0ebead9f5dee2d56a;hb=18d03456d96f7a086a2ccc82ce97fcf056848d90;hp=0000000000000000000000000000000000000000;hpb=a1571d413d2acac5d4a4fbdf2e50b2d1a6da3aa6;p=protos%2Flibecoli.git diff --git a/include/ecoli_utils.h b/include/ecoli_utils.h new file mode 100644 index 0000000..5a14192 --- /dev/null +++ b/include/ecoli_utils.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018, Olivier MATZ + */ + +#ifndef ECOLI_UTILS_ +#define ECOLI_UTILS_ + +/** + * Cast a variable into a type, ensuring its initial type first + */ +#define EC_CAST(x, old_type, new_type) ({ \ + old_type __x = (x); \ + (new_type)__x; \ + }) + +#endif