Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You got homework? a generic one, tested if g++, <a href="http://effocore.googlecode.com/svn/trunk/devel/effo/codebase/addons/inl/include/impl/algo_impl.h" rel="nofollow noreferrer">http://effocore.googlecode.com/svn/trunk/devel/effo/codebase/addons/inl/include/impl/algo_impl.h</a> :</p> <pre><code>#ifdef __cplusplus static inline char *int2a_put(uintptr_t i, char *s) { do { *s++ = '0' + i % 10; i /= 10; } while (i); return s; } static inline void int2a_reverse(char *head, char *tail) { for (*tail = '\0'; --tail &gt; head; ++head) { /* exchange */ (*head) ^= (*tail); (*tail) ^= (*head); (*head) ^= (*tail); } } template&lt;typename t&gt; static inline const char *int2a(t i, char *s) { char *p; char *ret = s; bool f = false; p = s; if (i &lt; 0) { *p++ = '-'; ++ s; /* * In limits.h, INT_MAX was defined as * maximum values a `signed int' can hold. * and LONG_MAX was defined as maximum values * a `signed long int' can hold. */ switch (sizeof(t)) { case 8: { /* * Inject \p a to prevent from complaint * of compiler. */ ef64_t a = (ef64_t)i; if (-LLONG_MAX &gt; a) { i = (t)LLONG_MAX; f = true; } } break; case 4: case 2: case 1: { /* * Inject \p a to prevent from complaint * of compiler. */ int a = (int)i; if (-INT_MAX &gt; a) { i = (t)INT_MAX; f = true; } } break; default: break; } if (!f) { i = -i; } } p = int2a_put((uintptr_t)i, p); if (f) { ++ *s; } int2a_reverse(s, p); return ret; } /* * No "static" otherwise g++ complains * "explicit template specialization cannot have a storage class" */ template&lt;&gt; /*static*/ inline const char *int2a&lt;uintptr_t&gt;(uintptr_t i, char *s) { char *p = int2a_put(i, s); int2a_reverse(s, p); return s; } #else </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload