1 /** 2 * \file 3 * 4 * \brief Decrement macro. 5 * 6 * Copyright (C) 2014 Atmel Corporation. All rights reserved. 7 * 8 * \asf_license_start 9 * 10 * \page License 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions are met: 14 * 15 * 1. Redistributions of source code must retain the above copyright notice, 16 * this list of conditions and the following disclaimer. 17 * 18 * 2. Redistributions in binary form must reproduce the above copyright notice, 19 * this list of conditions and the following disclaimer in the documentation 20 * and/or other materials provided with the distribution. 21 * 22 * 3. The name of Atmel may not be used to endorse or promote products derived 23 * from this software without specific prior written permission. 24 * 25 * 4. This software may only be redistributed and used in connection with an 26 * Atmel microcontroller product. 27 * 28 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 * POSSIBILITY OF SUCH DAMAGE. 39 * 40 * \asf_license_stop 41 * 42 */ 43 44 #ifndef _UTILS_DECREMENT_MACRO_H 45 #define _UTILS_DECREMENT_MACRO_H 46 47 #ifdef __cplusplus 48 extern "C" { 49 #endif 50 51 /** 52 * \brief Compile time decrement, result value is entire integer literal 53 * 54 * \param[in] val - value to be decremented 55 */ 56 #define DEC_VALUE(val) DEC_##val 57 58 // Preprocessor increment implementation 59 #define DEC_256 255 60 #define DEC_255 254 61 #define DEC_254 253 62 #define DEC_253 252 63 #define DEC_252 251 64 #define DEC_251 250 65 #define DEC_250 249 66 #define DEC_249 248 67 #define DEC_248 247 68 #define DEC_247 246 69 #define DEC_246 245 70 #define DEC_245 244 71 #define DEC_244 243 72 #define DEC_243 242 73 #define DEC_242 241 74 #define DEC_241 240 75 #define DEC_240 239 76 #define DEC_239 238 77 #define DEC_238 237 78 #define DEC_237 236 79 #define DEC_236 235 80 #define DEC_235 234 81 #define DEC_234 233 82 #define DEC_233 232 83 #define DEC_232 231 84 #define DEC_231 230 85 #define DEC_230 229 86 #define DEC_229 228 87 #define DEC_228 227 88 #define DEC_227 226 89 #define DEC_226 225 90 #define DEC_225 224 91 #define DEC_224 223 92 #define DEC_223 222 93 #define DEC_222 221 94 #define DEC_221 220 95 #define DEC_220 219 96 #define DEC_219 218 97 #define DEC_218 217 98 #define DEC_217 216 99 #define DEC_216 215 100 #define DEC_215 214 101 #define DEC_214 213 102 #define DEC_213 212 103 #define DEC_212 211 104 #define DEC_211 210 105 #define DEC_210 209 106 #define DEC_209 208 107 #define DEC_208 207 108 #define DEC_207 206 109 #define DEC_206 205 110 #define DEC_205 204 111 #define DEC_204 203 112 #define DEC_203 202 113 #define DEC_202 201 114 #define DEC_201 200 115 #define DEC_200 199 116 #define DEC_199 198 117 #define DEC_198 197 118 #define DEC_197 196 119 #define DEC_196 195 120 #define DEC_195 194 121 #define DEC_194 193 122 #define DEC_193 192 123 #define DEC_192 191 124 #define DEC_191 190 125 #define DEC_190 189 126 #define DEC_189 188 127 #define DEC_188 187 128 #define DEC_187 186 129 #define DEC_186 185 130 #define DEC_185 184 131 #define DEC_184 183 132 #define DEC_183 182 133 #define DEC_182 181 134 #define DEC_181 180 135 #define DEC_180 179 136 #define DEC_179 178 137 #define DEC_178 177 138 #define DEC_177 176 139 #define DEC_176 175 140 #define DEC_175 174 141 #define DEC_174 173 142 #define DEC_173 172 143 #define DEC_172 171 144 #define DEC_171 170 145 #define DEC_170 169 146 #define DEC_169 168 147 #define DEC_168 167 148 #define DEC_167 166 149 #define DEC_166 165 150 #define DEC_165 164 151 #define DEC_164 163 152 #define DEC_163 162 153 #define DEC_162 161 154 #define DEC_161 160 155 #define DEC_160 159 156 #define DEC_159 158 157 #define DEC_158 157 158 #define DEC_157 156 159 #define DEC_156 155 160 #define DEC_155 154 161 #define DEC_154 153 162 #define DEC_153 152 163 #define DEC_152 151 164 #define DEC_151 150 165 #define DEC_150 149 166 #define DEC_149 148 167 #define DEC_148 147 168 #define DEC_147 146 169 #define DEC_146 145 170 #define DEC_145 144 171 #define DEC_144 143 172 #define DEC_143 142 173 #define DEC_142 141 174 #define DEC_141 140 175 #define DEC_140 139 176 #define DEC_139 138 177 #define DEC_138 137 178 #define DEC_137 136 179 #define DEC_136 135 180 #define DEC_135 134 181 #define DEC_134 133 182 #define DEC_133 132 183 #define DEC_132 131 184 #define DEC_131 130 185 #define DEC_130 129 186 #define DEC_129 128 187 #define DEC_128 127 188 #define DEC_127 126 189 #define DEC_126 125 190 #define DEC_125 124 191 #define DEC_124 123 192 #define DEC_123 122 193 #define DEC_122 121 194 #define DEC_121 120 195 #define DEC_120 119 196 #define DEC_119 118 197 #define DEC_118 117 198 #define DEC_117 116 199 #define DEC_116 115 200 #define DEC_115 114 201 #define DEC_114 113 202 #define DEC_113 112 203 #define DEC_112 111 204 #define DEC_111 110 205 #define DEC_110 109 206 #define DEC_109 108 207 #define DEC_108 107 208 #define DEC_107 106 209 #define DEC_106 105 210 #define DEC_105 104 211 #define DEC_104 103 212 #define DEC_103 102 213 #define DEC_102 101 214 #define DEC_101 100 215 #define DEC_100 99 216 #define DEC_99 98 217 #define DEC_98 97 218 #define DEC_97 96 219 #define DEC_96 95 220 #define DEC_95 94 221 #define DEC_94 93 222 #define DEC_93 92 223 #define DEC_92 91 224 #define DEC_91 90 225 #define DEC_90 89 226 #define DEC_89 88 227 #define DEC_88 87 228 #define DEC_87 86 229 #define DEC_86 85 230 #define DEC_85 84 231 #define DEC_84 83 232 #define DEC_83 82 233 #define DEC_82 81 234 #define DEC_81 80 235 #define DEC_80 79 236 #define DEC_79 78 237 #define DEC_78 77 238 #define DEC_77 76 239 #define DEC_76 75 240 #define DEC_75 74 241 #define DEC_74 73 242 #define DEC_73 72 243 #define DEC_72 71 244 #define DEC_71 70 245 #define DEC_70 69 246 #define DEC_69 68 247 #define DEC_68 67 248 #define DEC_67 66 249 #define DEC_66 65 250 #define DEC_65 64 251 #define DEC_64 63 252 #define DEC_63 62 253 #define DEC_62 61 254 #define DEC_61 60 255 #define DEC_60 59 256 #define DEC_59 58 257 #define DEC_58 57 258 #define DEC_57 56 259 #define DEC_56 55 260 #define DEC_55 54 261 #define DEC_54 53 262 #define DEC_53 52 263 #define DEC_52 51 264 #define DEC_51 50 265 #define DEC_50 49 266 #define DEC_49 48 267 #define DEC_48 47 268 #define DEC_47 46 269 #define DEC_46 45 270 #define DEC_45 44 271 #define DEC_44 43 272 #define DEC_43 42 273 #define DEC_42 41 274 #define DEC_41 40 275 #define DEC_40 39 276 #define DEC_39 38 277 #define DEC_38 37 278 #define DEC_37 36 279 #define DEC_36 35 280 #define DEC_35 34 281 #define DEC_34 33 282 #define DEC_33 32 283 #define DEC_32 31 284 #define DEC_31 30 285 #define DEC_30 29 286 #define DEC_29 28 287 #define DEC_28 27 288 #define DEC_27 26 289 #define DEC_26 25 290 #define DEC_25 24 291 #define DEC_24 23 292 #define DEC_23 22 293 #define DEC_22 21 294 #define DEC_21 20 295 #define DEC_20 19 296 #define DEC_19 18 297 #define DEC_18 17 298 #define DEC_17 16 299 #define DEC_16 15 300 #define DEC_15 14 301 #define DEC_14 13 302 #define DEC_13 12 303 #define DEC_12 11 304 #define DEC_11 10 305 #define DEC_10 9 306 #define DEC_9 8 307 #define DEC_8 7 308 #define DEC_7 6 309 #define DEC_6 5 310 #define DEC_5 4 311 #define DEC_4 3 312 #define DEC_3 2 313 #define DEC_2 1 314 #define DEC_1 0 315 316 #ifdef __cplusplus 317 } 318 #endif 319 #endif /* _UTILS_DECREMENT_MACRO_H */ 320