/* * These are types: corresponding to the smallest unsigned/signed * integer type no smaller than int or long, respectively, capable of * holding the argument (which can be anything that can be validly * passed to sizeof().) * * If the size is too large even for a long long, they return an * unnamed structure type with the right sizeof(), which if used for a * cast will generate the error message: * * error: conversion to non-scalar type requested */ #define __uinttype(x) \ __typeof__(__builtin_choose_expr(sizeof(x) <= sizeof(0U), 0U, \ __builtin_choose_expr(sizeof(x) <= sizeof(0UL), 0UL, \ __builtin_choose_expr(sizeof(x) <= sizeof(0ULL), 0ULL, \ ({ struct { unsigned char __bad[sizeof(x)]; } __bad = {{0}}; \ __bad; }))))) #define __sinttype(x) \ __typeof__(__builtin_choose_expr(sizeof(x) <= sizeof(0), 0, \ __builtin_choose_expr(sizeof(x) <= sizeof(0L), 0L, \ __builtin_choose_expr(sizeof(x) <= sizeof(0LL), 0LL, \ ({ struct { signed char __bad[sizeof(x)]; } __bad = {{0}}; \ __bad; }))))) #define __ulongtype(x) \ __typeof__(__builtin_choose_expr(sizeof(x) <= sizeof(0UL), 0UL, \ __builtin_choose_expr(sizeof(x) <= sizeof(0ULL), 0ULL, \ ({ struct { unsigned char __bad[sizeof(x)]; } __bad = {{0}}; \ __bad; })))) #define __slongtype(x) \ __typeof__(__builtin_choose_expr(sizeof(x) <= sizeof(0L), 0L, \ __builtin_choose_expr(sizeof(x) <= sizeof(0LL), 0LL, \ ({ struct { signed char __bad[sizeof(x)]; } __bad = {{0}}; \ __bad; })))))