root/src/common/utils.h

Revision 1, 1.1 kB (checked in by jinshiro, 17 years ago)
Line 
1// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
2// For more information, see LICENCE in the main folder
3
4#ifndef _UTILS_H_
5#define _UTILS_H_
6
7#ifndef _CBASETYPES_H_
8#include "../common/cbasetypes.h"
9#endif
10
11#include <stdio.h> // FILE*
12
13// generate a hex dump of the first 'length' bytes of 'buffer'
14void dump(FILE* fp, const unsigned char* buffer, int length);
15
16void findfile(const char *p, const char *pat, void (func)(const char*));
17
18//Caps values to min/max
19#define cap_value(a, min, max) ((a >= max) ? max : (a <= min) ? min : a)
20
21/// calculates the value of A / B, in percent (rounded down)
22unsigned int get_percentage(const unsigned int A, const unsigned int B);
23
24//////////////////////////////////////////////////////////////////////////
25// byte word dword access [Shinomori]
26//////////////////////////////////////////////////////////////////////////
27
28extern uint8 GetByte(uint32 val, int idx);
29extern uint16 GetWord(uint32 val, int idx);
30extern uint16 MakeWord(uint8 byte0, uint8 byte1);
31extern uint32 MakeDWord(uint16 word0, uint16 word1);
32
33#endif /* _UTILS_H_ */
Note: See TracBrowser for help on using the browser.