X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Ftype-props.h;h=9225041740b8fd503a5c60f265ce8441ab6ae85b;hb=6da1e8091eb2e19de7ba5e0c73ac3e7dd437743d;hp=efaf4a5de48c649d7872663ce6809c04aa832111;hpb=34e63086edddcae06d7c1a4fa84fec0861e50758;p=sliver-openvswitch.git diff --git a/lib/type-props.h b/lib/type-props.h index efaf4a5de..922504174 100644 --- a/lib/type-props.h +++ b/lib/type-props.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008 Nicira Networks. + * Copyright (c) 2008, 2011 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,4 +29,11 @@ ? ~(~(TYPE)0 << TYPE_VALUE_BITS(TYPE)) \ : (TYPE)-1) +/* Number of decimal digits required to format an integer of the given TYPE. + * Includes space for a sign, if TYPE is signed, but not for a null + * terminator. + * + * The value is an overestimate. */ +#define INT_STRLEN(TYPE) (TYPE_IS_SIGNED(TYPE) + TYPE_VALUE_BITS(TYPE) / 3 + 1) + #endif /* type-props.h */