mirror of
https://github.com/reactos/reactos.git
synced 2024-11-05 22:26:39 +00:00
c2d0d784c7
- Create a branch to do a proper merge of USB work from a trunk base instead of from cmake-bringup - In the future, DO NOT under any circumstances branch another branch. This leads to merge problems! svn path=/branches/usb-bringup-trunk/; revision=55018
71 lines
1.5 KiB
C
71 lines
1.5 KiB
C
/*
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
* PROJECT: ReactOS Runtime Library
|
|
* PURPOSE: Slist Routines
|
|
* FILE: lib/rtl/slist.c
|
|
* PROGRAMERS: Stefan Ginsberg (stefan__100__@hotmail.com)
|
|
*/
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
#include <rtl.h>
|
|
|
|
#define NDEBUG
|
|
#include <debug.h>
|
|
|
|
/* FUNCTIONS ***************************************************************/
|
|
|
|
VOID
|
|
NTAPI
|
|
RtlInitializeSListHead(IN PSLIST_HEADER ListHead)
|
|
{
|
|
#ifdef _WIN64
|
|
ListHead->Alignment = 0;
|
|
ListHead->Region = 0;
|
|
ListHead->Header8.Init = 1;
|
|
// ListHead->Header8.HeaderType = 1; // FIXME: depending on cmpxchg16b support?
|
|
#else
|
|
ListHead->Alignment = 0;
|
|
#endif
|
|
}
|
|
|
|
PSLIST_ENTRY
|
|
NTAPI
|
|
RtlFirstEntrySList(IN const SLIST_HEADER *ListHead)
|
|
{
|
|
#ifdef _WIN64
|
|
if (ListHead->Header8.HeaderType)
|
|
{
|
|
return (PVOID)(ListHead->Region & ~0xF);
|
|
}
|
|
else
|
|
{
|
|
union {
|
|
PVOID P;
|
|
struct {
|
|
ULONG64 Reserved:4;
|
|
ULONG64 NextEntry:39;
|
|
ULONG64 Reserved2:21;
|
|
} Bits;
|
|
} Pointer;
|
|
|
|
Pointer.P = (PVOID)ListHead;
|
|
Pointer.Bits.NextEntry = ListHead->Header8.NextEntry;
|
|
return Pointer.P;
|
|
}
|
|
#else
|
|
return ListHead->Next.Next;
|
|
#endif
|
|
}
|
|
|
|
WORD
|
|
NTAPI
|
|
RtlQueryDepthSList(IN PSLIST_HEADER ListHead)
|
|
{
|
|
#ifdef _WIN64
|
|
return ListHead->Header8.HeaderType ?
|
|
ListHead->Header16.Sequence : ListHead->Header8.Sequence;
|
|
#else
|
|
return ListHead->Depth;
|
|
#endif
|
|
}
|