[前][次][番号順一覧][スレッド一覧]

ruby-changes:65756

From: Nobuyoshi <ko1@a...>
Date: Sun, 4 Apr 2021 23:29:47 +0900 (JST)
Subject: [ruby-changes:65756] 3cd3d25dde (master): Unify code by word sizes

https://git.ruby-lang.org/ruby.git/commit/?id=3cd3d25dde

From 3cd3d25dde87b5afec30881ec72cedf92216155f Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 4 Apr 2021 21:52:50 +0900
Subject: Unify code by word sizes

---
 vm_dump.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/vm_dump.c b/vm_dump.c
index 657bab1..109757a 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -796,12 +796,9 @@ print_machine_register(size_t reg, const char *reg_name, int col_count, int max_ https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L796
 {
     int ret;
     char buf[64];
+    static const int size_width = sizeof(size_t) * CHAR_BIT / 4;
 
-#ifdef __LP64__
-    ret = snprintf(buf, sizeof(buf), " %3.3s: 0x%016" PRIxSIZE, reg_name, reg);
-#else
-    ret = snprintf(buf, sizeof(buf), " %3.3s: 0x%08" PRIxSIZE, reg_name, reg);
-#endif
+    ret = snprintf(buf, sizeof(buf), " %3.3s: 0x%.*" PRIxSIZE, reg_name, size_width, reg);
     if (col_count + ret > max_col) {
 	fputs("\n", stderr);
 	col_count = 0;
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]