13#ifndef __CROSSNT_MISC__H__
22#if defined _X86_ && defined __CROSS_VERSION_LIB_NT__H__
24#define AcquireXLock(gLock, oldValue, newValue) \
26 PULONG _gLock_ = &(gLock); \
28 __asm mov eax,newValue \
29 __asm mov ebx,_gLock_ \
30 __asm xchg eax,[ebx] \
31 __asm mov oldValue,eax \
41#define MOV_DD_SWP(a,b) _MOV_DD_SWP(&(a),&(b))
60#define MOV_DW_SWP(a,b) _MOV_DW_SWP(&(a),&(b))
80#define REVERSE_DD(a) _REVERSE_DD(&(a))
95#define REVERSE_DW(a) _REVERSE_DW(&(a))
109#define MOV_DW2DD_SWP(a,b) _MOV_DW2DD_SWP(&(a),&(b))
129#define MOV_MSF(a,b) _MOV_MSF(&(a),&(b))
149#define MOV_MSF_SWP(a,b) _MOV_MSF_SWP(&(a),&(b))
170#define XCHG_DD(a,b) _XCHG_DD(&(a),&(b))
185#define AcquireXLock(gLock, oldValue, newValue) \
191#define MOV_DD_SWP(a,b) \
193 PFOUR_BYTE _from_, _to_; \
194 _from_ = ((PFOUR_BYTE)&(b)); \
195 _to_ = ((PFOUR_BYTE)&(a)); \
196 _to_->Byte0 = _from_->Byte3; \
197 _to_->Byte1 = _from_->Byte2; \
198 _to_->Byte2 = _from_->Byte1; \
199 _to_->Byte3 = _from_->Byte0; \
202#define MOV_DW_SWP(a,b) \
204 PFOUR_BYTE _from_, _to_; \
205 _from_ = ((PFOUR_BYTE)&(b)); \
206 _to_ = ((PFOUR_BYTE)&(a)); \
207 _to_->Byte0 = _from_->Byte1; \
208 _to_->Byte1 = _from_->Byte0; \
211#define REVERSE_DD(a) { \
213 MOV_DD_SWP(_i_,(a)); \
214 *((PULONG)&(a)) = _i_; \
217#define REVERSE_DW(a) { \
219 MOV_DW_SWP(_i_,(a)); \
220 *((PUSHORT)&(a)) = _i_; \
223#define MOV_DW2DD_SWP(a,b) \
225 PFOUR_BYTE _from_, _to_; \
226 _from_ = ((PFOUR_BYTE)&(b)); \
227 _to_ = ((PFOUR_BYTE)&(a)); \
228 *((PUSHORT)_to_) = 0; \
229 _to_->Byte2 = _from_->Byte1; \
230 _to_->Byte3 = _from_->Byte0; \
233#define MOV_MSF(a,b) \
235 PFOUR_BYTE _from_, _to_; \
236 _from_ = ((PFOUR_BYTE)&(b)); \
237 _to_ = ((PFOUR_BYTE)&(a)); \
238 _to_->Byte0 = _from_->Byte0; \
239 _to_->Byte1 = _from_->Byte1; \
240 _to_->Byte2 = _from_->Byte2; \
243#define MOV_MSF_SWP(a,b) \
245 PFOUR_BYTE _from_, _to_; \
246 _from_ = ((PFOUR_BYTE)&(b)); \
247 _to_ = ((PFOUR_BYTE)&(a)); \
248 _to_->Byte0 = _from_->Byte2; \
249 _to_->Byte1 = _from_->Byte1; \
250 _to_->Byte2 = _from_->Byte0; \
253#define XCHG_DD(a,b) \
256 PULONG _from_, _to_; \
257 _from_ = ((PULONG)&(b)); \
258 _to_ = ((PULONG)&(a)); \
268#define CONV_TO_LL(a) a.Byte0 | a.Byte1 << 8 | a.Byte2 << 16 | a.Byte3 << 8
269#define MSF_TO_LBA(Minutes,Seconds,Frames) \
270 (ULONG)((60 * 75 * (Minutes)) + (75 * (Seconds)) + ((Frames) - 150))
272#define PacketFixed2Variable(x,ps) ( ( ( (x) / (ps) ) * (ps+7) ) + ( (x) & (ps-1) ) )
273#define PacketVariable2Fixed(x,ps) ( ( ( (x) / (ps+7) ) * (ps) ) + ( (((x) % (ps+7)) < (ps)) ? ((x) % (ps+7)) : (ps-1) ) )
275#define WAIT_FOR_XXX_EMU_DELAY 1000LL
277#define max(a,b) (((a) > (b)) ? (a) : (b))
278#define min(a,b) (((a) < (b)) ? (a) : (b))
281#define offsetof(type, field) (ULONG)&(((type *)0)->field)
ptrREVERSE_DD _REVERSE_DD
ptrMOV_DD_SWP _MOV_DD_SWP
void __fastcall _REVERSE_DW(void *a)
void __fastcall _MOV_DW_SWP(void *a, void *b)
void __fastcall _MOV_MSF(void *a, void *b)
ptrMOV_MSF_SWP _MOV_MSF_SWP
void __fastcall _MOV_DW2DD_SWP(void *a, void *b)
void __fastcall _XCHG_DD(void *a, void *b)
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a