From ece1981634d7a8723d996f0536cf07414286fc19 Mon Sep 17 00:00:00 2001 From: sof <unknown> Date: Tue, 21 Sep 1999 09:46:04 +0000 Subject: [PATCH] [project @ 1999-09-21 09:46:04 by sof] v1.2 of Show Addr instance, pad out to fixed length --- ghc/lib/exts/Addr.lhs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ghc/lib/exts/Addr.lhs b/ghc/lib/exts/Addr.lhs index 5e02bf2d9fa6..58d45de0277a 100644 --- a/ghc/lib/exts/Addr.lhs +++ b/ghc/lib/exts/Addr.lhs @@ -5,6 +5,8 @@ \section[Addr]{Module @Addr@} \begin{code} +#include "MachDeps.h" + module Addr ( Addr @@ -51,8 +53,12 @@ import Int ( indexInt8OffAddr, indexInt16OffAddr \begin{code} instance Show Addr where - showsPrec p (A# a) = showHex int + showsPrec p (A# a) rs = pad_out (showHex int rs) where + -- want 0s prefixed to pad it out to a fixed length. + pad_out ('0':'x':ls) = + '0':'x':(replicate (2*ADDR_SIZE_IN_BYTES - length ls) '0') ++ ls + int = case word2Integer# (int2Word# (addr2Int# a)) of (# s, d #) -> J# s d -- GitLab