summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-06-26 21:03:31 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-06-26 21:03:31 +0000
commitcd9523853d03d6b341219801af8a1d44635ac825 (patch)
tree0df08aa035846d9e84a1b988f79d184ac55e4ac7 /src/common
parent0507af994a40360293a1da770e8e66c58cf7b632 (diff)
downloadhercules-cd9523853d03d6b341219801af8a1d44635ac825.tar.gz
hercules-cd9523853d03d6b341219801af8a1d44635ac825.tar.bz2
hercules-cd9523853d03d6b341219801af8a1d44635ac825.tar.xz
hercules-cd9523853d03d6b341219801af8a1d44635ac825.zip
* Changed the string hash of the script engine to SDBM.
* Reporting information about script data when an error occurs. * More work on ticket #41 (array functions). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10813 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r--src/common/utils.c35
-rw-r--r--src/common/utils.h8
2 files changed, 24 insertions, 19 deletions
diff --git a/src/common/utils.c b/src/common/utils.c
index b738d31c8..00b6dc290 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -294,30 +294,35 @@ void findfile(const char *p, const char *pat, void (func)(const char*))
}
#endif
-unsigned char GetByte(unsigned long val, size_t num)
+uint8 GetByte(uint32 val, size_t num)
{
- switch(num) {
- case 0: return (unsigned char)((val & 0x000000FF) );
- case 1: return (unsigned char)((val & 0x0000FF00)>>0x08);
- case 2: return (unsigned char)((val & 0x00FF0000)>>0x10);
- case 3: return (unsigned char)((val & 0xFF000000)>>0x18);
+ switch( num )
+ {
+ case 0: return (uint8)((val & 0x000000FF) );
+ case 1: return (uint8)((val & 0x0000FF00) >> 0x08);
+ case 2: return (uint8)((val & 0x00FF0000) >> 0x10);
+ case 3: return (uint8)((val & 0xFF000000) >> 0x18);
default: return 0; //better throw something here
}
}
-unsigned short GetWord(unsigned long val, size_t num)
+uint16 GetWord(uint32 val, size_t num)
{
- switch(num) {
- case 0: return (unsigned short)((val & 0x0000FFFF) );
- case 1: return (unsigned short)((val & 0xFFFF0000)>>0x10);
+ switch( num )
+ {
+ case 0: return (uint16)((val & 0x0000FFFF) );
+ case 1: return (uint16)((val & 0xFFFF0000) >> 0x10);
default: return 0; //better throw something here
}
}
-unsigned short MakeWord(unsigned char byte0, unsigned char byte1)
+uint16 MakeWord(uint8 byte0, uint8 byte1)
{
- return byte0 | (byte1<<0x08);
+ return
+ ((uint16)(byte0 ))|
+ ((uint16)(byte1 << 0x08));
}
-unsigned long MakeDWord(unsigned short word0, unsigned short word1)
+uint32 MakeDWord(uint16 word0, uint16 word1)
{
- return ((unsigned long)word0)
- | ((unsigned long)word1<<0x10);
+ return
+ ((uint32)(word0 ))|
+ ((uint32)(word1 << 0x10));
}
diff --git a/src/common/utils.h b/src/common/utils.h
index ba02fc5f1..66ce04c99 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -38,9 +38,9 @@ void findfile(const char *p, const char *pat, void (func)(const char*));
// byte word dword access [Shinomori]
//////////////////////////////////////////////////////////////////////////
-extern unsigned char GetByte(unsigned long val, size_t num);
-extern unsigned short GetWord(unsigned long val, size_t num);
-extern unsigned short MakeWord(unsigned char byte0, unsigned char byte1);
-extern unsigned long MakeDWord(unsigned short word0, unsigned short word1);
+extern uint8 GetByte(uint32 val, size_t num);
+extern uint16 GetWord(uint32 val, size_t num);
+extern uint16 MakeWord(uint8 byte0, uint8 byte1);
+extern uint32 MakeDWord(uint16 word0, uint16 word1);
#endif /* _UTILS_H_ */