Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 32,328 of 33,346    |
|    Seungbeom Kim to Seungbeom Kim    |
|    Re: Getting the smallest signed type tha    |
|    23 May 12 12:12:51    |
   
   From: musiphil@bawi.org   
      
   On 2012-05-15 21:23, Seungbeom Kim wrote:   
   >   
   > The problem is, how do you determine S? Of course, S should be large   
   > enough to represent all the values of U. To be safe, you could just   
   > use S=intmax_t for every U, but that might be an overkill; if   
   > U=uint16_t, then S=uint32_t is enough, and you don't want to use   
   > more expensive arithmetic in uint64_t or uint128_t. So, something   
   > like S=int_least[N+1]_t where N=numeric_limits ::digits() would   
   > be desirable (+1 because of the sign bit).   
      
   A useful tool for programmers to have is a template version of   
   [u]int_{least,fast}[N]_t: if we had   
      
    namespace std   
    {   
    template
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca