Hengband  2.2.1
z-util.h
[詳解]
1 /* File z-util.h */
2 
3 /*
4  * Copyright (c) 1997 Ben Harrison
5  *
6  * This software may be copied and distributed for educational, research,
7  * and not for profit purposes provided that this copyright and statement
8  * are included in all such copies.
9  */
10 
11 #ifndef INCLUDED_Z_UTIL_H
12 #define INCLUDED_Z_UTIL_H
13 
14 #include "h-basic.h"
15 
16 
17 /*
18  * Extremely basic stuff, like global temp and constant variables.
19  * Also, some very useful low level functions, such as "streq()".
20  * All variables and functions in this file are "addressable".
21  */
22 
23 
24 /**** Available variables ****/
25 
26 /* A concptr to the name of the program */
27 extern concptr argv0;
28 
29 
30 /* Aux functions */
31 extern void (*plog_aux)(concptr);
32 extern void (*quit_aux)(concptr);
33 extern void (*core_aux)(concptr);
34 
35 
36 /**** Available Functions ****/
37 
38 /* Test equality, prefix, suffix */
39 extern bool streq(concptr s, concptr t);
40 extern bool prefix(concptr s, concptr t);
41 extern bool suffix(concptr s, concptr t);
42 
43 
44 /* Print an error message */
45 extern void plog(concptr str);
46 
47 /* Exit, with optional message */
48 extern void quit(concptr str);
49 
50 /* Dump core, with optional message */
51 extern void core(concptr str);
52 
53 
54 /* 64-bit integer operations */
55 #define s64b_LSHIFT(V1, V2, N) {V1 = (V1<<(N)) | (V2>>(32-(N))); V2 <<= (N);}
56 #define s64b_RSHIFT(V1, V2, N) {V2 = (V1<<(32-(N))) | (V2>>(N)); V1 >>= (N);}
57 extern void s64b_add(s32b *A1, u32b *A2, s32b B1, u32b B2);
58 extern void s64b_sub(s32b *A1, u32b *A2, s32b B1, u32b B2);
59 extern int s64b_cmp(s32b A1, u32b A2, s32b B1, u32b B2);
60 extern void s64b_mul(s32b *A1, u32b *A2, s32b B1, u32b B2);
61 extern void s64b_div(s32b *A1, u32b *A2, s32b B1, u32b B2);
62 extern void s64b_mod(s32b *A1, u32b *A2, s32b B1, u32b B2);
63 
64 
65 #endif
66 
67 extern int count_bits(BIT_FLAGS x);
68 extern int mysqrt(int n);
69 
int count_bits(BIT_FLAGS x)
符号なし32ビット整数のビット数を返す。
Definition: z-util.c:274
const char * concptr
文字列定数用ポインタ定義 / A simple pointer (to unmodifiable strings)
Definition: h-type.h:47
void core(concptr str)
Definition: z-util.c:125
void s64b_sub(s32b *A1, u32b *A2, s32b B1, u32b B2)
Definition: z-util.c:159
int mysqrt(int n)
平方根を切り捨て整数で返す
Definition: z-util.c:291
bool prefix(concptr s, concptr t)
Definition: z-util.c:50
void plog(concptr str)
Definition: z-util.c:74
void s64b_mul(s32b *A1, u32b *A2, s32b B1, u32b B2)
Definition: z-util.c:182
変愚時追加された基本事項のヘッダーファイル / The most basic "include" file.
u32b BIT_FLAGS
32ビットのフラグ配列の型定義
Definition: h-type.h:225
void(* plog_aux)(concptr)
Definition: z-util.c:68
signed long s32b
Definition: h-type.h:107
unsigned long u32b
Definition: h-type.h:108
bool suffix(concptr s, concptr t)
Definition: z-util.c:34
void s64b_add(s32b *A1, u32b *A2, s32b B1, u32b B2)
Definition: z-util.c:146
bool streq(concptr s, concptr t)
Definition: z-util.c:25
void(* quit_aux)(concptr)
Definition: z-util.c:88
void s64b_div(s32b *A1, u32b *A2, s32b B1, u32b B2)
Definition: z-util.c:216
void quit(concptr str)
Definition: z-util.c:96
void s64b_mod(s32b *A1, u32b *A2, s32b B1, u32b B2)
Definition: z-util.c:259
void(* core_aux)(concptr)
Definition: z-util.c:119
int s64b_cmp(s32b A1, u32b A2, s32b B1, u32b B2)
Definition: z-util.c:202
concptr argv0
Definition: z-util.c:19