From c306f48c14670d287db3375e48c7eb61e9c7b211 Mon Sep 17 00:00:00 2001 From: nickysn Date: Fri, 4 Jul 2014 08:34:17 +0000 Subject: [PATCH] + added rtl helpers for huge pointer comparisons git-svn-id: trunk@28148 - --- rtl/i8086/hugeptr.inc | 30 ++++++++++++++++++++++++++++++ rtl/inc/compproc.inc | 7 +++++++ 2 files changed, 37 insertions(+) diff --git a/rtl/i8086/hugeptr.inc b/rtl/i8086/hugeptr.inc index 327d60ea86..8247fde9b4 100644 --- a/rtl/i8086/hugeptr.inc +++ b/rtl/i8086/hugeptr.inc @@ -77,3 +77,33 @@ begin linear:=(LongInt(Seg(p^)) shl 4)+Ofs(p^)-n; p:=HugePointer(Ptr(linear shr 4,linear and $F)); end; + +function fpc_hugeptr_cmp_normalized_e(p1, p2: HugePointer): Boolean; compilerproc; +begin + fpc_hugeptr_cmp_normalized_e:=((LongInt(Seg(p1^)) shl 4)+Ofs(p1^))=((LongInt(Seg(p2^)) shl 4)+Ofs(p2^)); +end; + +function fpc_hugeptr_cmp_normalized_ne(p1, p2: HugePointer): Boolean; compilerproc; +begin + fpc_hugeptr_cmp_normalized_ne:=((LongInt(Seg(p1^)) shl 4)+Ofs(p1^))<>((LongInt(Seg(p2^)) shl 4)+Ofs(p2^)); +end; + +function fpc_hugeptr_cmp_normalized_b(p1, p2: HugePointer): Boolean; compilerproc; +begin + fpc_hugeptr_cmp_normalized_b:=((LongInt(Seg(p1^)) shl 4)+Ofs(p1^))<((LongInt(Seg(p2^)) shl 4)+Ofs(p2^)); +end; + +function fpc_hugeptr_cmp_normalized_be(p1, p2: HugePointer): Boolean; compilerproc; +begin + fpc_hugeptr_cmp_normalized_be:=((LongInt(Seg(p1^)) shl 4)+Ofs(p1^))<=((LongInt(Seg(p2^)) shl 4)+Ofs(p2^)); +end; + +function fpc_hugeptr_cmp_normalized_a(p1, p2: HugePointer): Boolean; compilerproc; +begin + fpc_hugeptr_cmp_normalized_a:=((LongInt(Seg(p1^)) shl 4)+Ofs(p1^))>((LongInt(Seg(p2^)) shl 4)+Ofs(p2^)); +end; + +function fpc_hugeptr_cmp_normalized_ae(p1, p2: HugePointer): Boolean; compilerproc; +begin + fpc_hugeptr_cmp_normalized_ae:=((LongInt(Seg(p1^)) shl 4)+Ofs(p1^))>=((LongInt(Seg(p2^)) shl 4)+Ofs(p2^)); +end; diff --git a/rtl/inc/compproc.inc b/rtl/inc/compproc.inc index 6a8b8cb067..c7cdc0afb2 100644 --- a/rtl/inc/compproc.inc +++ b/rtl/inc/compproc.inc @@ -757,4 +757,11 @@ procedure fpc_hugeptr_inc_longint(var p: HugePointer; n: LongInt); compilerproc; procedure fpc_hugeptr_inc_longint_normalized(var p: HugePointer; n: LongInt); compilerproc; procedure fpc_hugeptr_dec_longint(var p: HugePointer; n: LongInt); compilerproc; procedure fpc_hugeptr_dec_longint_normalized(var p: HugePointer; n: LongInt); compilerproc; + +function fpc_hugeptr_cmp_normalized_e(p1, p2: HugePointer): Boolean; compilerproc; +function fpc_hugeptr_cmp_normalized_ne(p1, p2: HugePointer): Boolean; compilerproc; +function fpc_hugeptr_cmp_normalized_b(p1, p2: HugePointer): Boolean; compilerproc; +function fpc_hugeptr_cmp_normalized_be(p1, p2: HugePointer): Boolean; compilerproc; +function fpc_hugeptr_cmp_normalized_a(p1, p2: HugePointer): Boolean; compilerproc; +function fpc_hugeptr_cmp_normalized_ae(p1, p2: HugePointer): Boolean; compilerproc; {$endif i8086}