--- nono/lib/header.h 2026/04/29 17:05:26 1.1.1.20 +++ nono/lib/header.h 2026/04/29 17:05:39 1.1.1.21 @@ -136,6 +136,10 @@ DEF_UNION64(union64, q, h, l); #define countof(x) (sizeof(x) / sizeof(x[0])) #endif +#ifndef howmany +#define howmany(x, y) (((x)+((y)-1))/(y)) +#endif + #ifndef roundup #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) #endif @@ -158,6 +162,12 @@ DEF_UNION64(union64, q, h, l); #define assertmsg(expr, ...) #endif +// __func__ のようだけどクラス名と関数名だけを表示する。 +// __PRETTY_FUNCTION__ が近いけど、あれは戻り値やら引数全部表示するので。 +#define __method__ \ + (get_classfunc_name(__PRETTY_FUNCTION__, __FUNCTION__).c_str()) +extern std::string get_classfunc_name(const char *pretty, const char *func); + // iconv() の第2引数の型は OS によって違う… #if defined(HAVE_ICONV_CONST) #define ICONV(cd, s, slen, d, dlen) iconv((cd), (s), (slen), (d), (dlen))