demOS
 All Data Structures Files Modules Pages
STANDARD.H
Go to the documentation of this file.
1 /*------------------------------------------------------------------------------ -----------------
2  Copyright J.Hubert 2015
3 
4  This file is part of demOS
5 
6  demOS is free software: you can redistribute it and/or modify it under the terms of
7  the GNU Lesser General Public License as published by the Free Software Foundation,
8  either version 3 of the License, or (at your option) any later version.
9 
10  demOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY ;
11  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  See the GNU Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public License along with demOS.
15  If not, see <http://www.gnu.org/licenses/>.
16 ------------------------------------------------------------------------------------------------- */
17 
28 #ifndef STANDARD_H
29 #define STANDARD_H
30 
31 #include "DEMOSDK\BASTYPES.H"
32 
33 #define STD_SWAP(type,A,B) { type T = A; A = B; B = T; }
34 
35 #define STD_MIN(A,B) ((A)<(B) ? (A):(B))
36 #define STD_MAX(A,B) ((A)>(B) ? (A):(B))
37 
38 void STDmset (void* _adr, u32 _value, u32 _length);
39 void STDmcpy (void* _dest, void* _src, u32 _length);
40 void STDuxtoa(char* _text, u32 _value, s16 _nbchars);
41 u16 STDmfrnd (void);
42 u16 STDifrnd (void);
43 u16 STDswap16(u16 _v);
44 u32 STDswap32(u32 _v);
45 u32 STDmulu (u16 _x, u16 _y);
46 s32 STDmuls (s16 _x, s16 _y);
47 u32 STDdivu (u32 _x, u16 _y);
48 u32 STDdivs (s32 _x, s16 _y);
49 void STDcpuSetSR (u16 _status);
50 void* STDgetSP(void);
51 void* STDgetUSP(void);
52 void STDsetUSP(void* _adr);
53 
54 #ifdef DEMOS_UNITTEST
55 void STD_unitTest (void);
56 #endif
57 
58 #endif
59 
BASTYPES