From 72b82b0f210ef47798133dabf2a81eef3e036ba6 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 7 Nov 2013 18:11:00 +0100 Subject: [PATCH] scm_from_uintptr_t / scm_from_ptrdiff_t usage * libguile/frames.c: * libguile/programs.c: Use scm_from_ptrdiff_t and scm_from_uintptr_t where appropriate. --- libguile/frames.c | 21 ++++++++++----------- libguile/programs.c | 3 +-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/libguile/frames.c b/libguile/frames.c index b2973bf67..847081890 100644 --- a/libguile/frames.c +++ b/libguile/frames.c @@ -142,7 +142,7 @@ SCM_DEFINE (scm_frame_num_locals, "frame-num-locals", 1, 0, 0, /* The frame size of an RTL program is fixed, except in the case of passing a wrong number of arguments to the program. So we do need to use an SP for determining the number of locals. */ - return scm_from_uint32 (sp + 1 - p); + return scm_from_ptrdiff_t (sp + 1 - p); sp = SCM_VM_FRAME_SP (frame); p = SCM_FRAME_STACK_ADDRESS (SCM_VM_FRAME_FP (frame)); @@ -234,7 +234,7 @@ SCM_DEFINE (scm_frame_address, "frame-address", 1, 0, 0, #define FUNC_NAME s_scm_frame_address { SCM_VALIDATE_VM_FRAME (1, frame); - return scm_from_unsigned_integer ((scm_t_bits) SCM_VM_FRAME_FP (frame)); + return scm_from_uintptr_t ((scm_t_uintptr) SCM_VM_FRAME_FP (frame)); } #undef FUNC_NAME @@ -245,7 +245,7 @@ SCM_DEFINE (scm_frame_stack_pointer, "frame-stack-pointer", 1, 0, 0, { SCM_VALIDATE_VM_FRAME (1, frame); - return scm_from_unsigned_integer ((scm_t_bits) SCM_VM_FRAME_SP (frame)); + return scm_from_uintptr_t ((scm_t_uintptr) SCM_VM_FRAME_SP (frame)); } #undef FUNC_NAME @@ -279,9 +279,8 @@ SCM_DEFINE (scm_frame_return_address, "frame-return-address", 1, 0, 0, #define FUNC_NAME s_scm_frame_return_address { SCM_VALIDATE_VM_FRAME (1, frame); - return scm_from_unsigned_integer ((scm_t_bits) - (SCM_FRAME_RETURN_ADDRESS - (SCM_VM_FRAME_FP (frame)))); + return scm_from_uintptr_t ((scm_t_uintptr) (SCM_FRAME_RETURN_ADDRESS + (SCM_VM_FRAME_FP (frame)))); } #undef FUNC_NAME @@ -291,9 +290,9 @@ SCM_DEFINE (scm_frame_mv_return_address, "frame-mv-return-address", 1, 0, 0, #define FUNC_NAME s_scm_frame_mv_return_address { SCM_VALIDATE_VM_FRAME (1, frame); - return scm_from_unsigned_integer ((scm_t_bits) - (SCM_FRAME_MV_RETURN_ADDRESS - (SCM_VM_FRAME_FP (frame)))); + return scm_from_uintptr_t ((scm_t_uintptr) + (SCM_FRAME_MV_RETURN_ADDRESS + (SCM_VM_FRAME_FP (frame)))); } #undef FUNC_NAME @@ -304,8 +303,8 @@ SCM_DEFINE (scm_frame_dynamic_link, "frame-dynamic-link", 1, 0, 0, { SCM_VALIDATE_VM_FRAME (1, frame); /* fixme: munge fp if holder is a continuation */ - return scm_from_ulong - ((unsigned long) + return scm_from_uintptr_t + ((scm_t_uintptr) RELOC (frame, SCM_FRAME_DYNAMIC_LINK (SCM_VM_FRAME_FP (frame)))); } diff --git a/libguile/programs.c b/libguile/programs.c index 5452112e8..77b6417c7 100644 --- a/libguile/programs.c +++ b/libguile/programs.c @@ -106,8 +106,7 @@ SCM_DEFINE (scm_rtl_program_code, "rtl-program-code", 1, 0, 0, { SCM_VALIDATE_RTL_PROGRAM (1, program); - /* FIXME: we need scm_from_uintptr (). */ - return scm_from_size_t ((size_t) SCM_RTL_PROGRAM_CODE (program)); + return scm_from_uintptr_t ((scm_t_uintptr) SCM_RTL_PROGRAM_CODE (program)); } #undef FUNC_NAME