# Another LLP64 problems

**URL:** <https://www.ruby-forum.com/t/another-llp64-problems/98717>\
**Category:** Development\
**Created:** [July 17, 2006, 7:13pm UTC](https://www.ruby-forum.com/t/another-llp64-problems/98717 "2006-07-17T19:13:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![U.Nakamura](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/b5ac83/32.png) [@U.Nakamura](https://www.ruby-forum.com/u/U.Nakamura)\
**Post date:** [July 17, 2006, 7:13pm UTC](https://www.ruby-forum.com/t/another-llp64-problems/98717/1 "2006-07-17T19:13:25Z")

</div>

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

FIX2LONGe$B\<~$j$NOC$r=|$1$P!"e(BIL32LLP64e$BBP1~$NLdBjE@$Oe(B(e$B$?$V$se(B)e$B$3$le(B  
e$B$,:G8e$G$9!#e(B

(1)  
e$BA0$K$bEj$2$?5$$,$7$^$9$,!"e(Bintern.he$B$Ne(Bst\_foreach\_safe()e$B$N@ke(B  
e$B8@$,Dj5A$H0[$J$j$^$9!#e(B  
(2) sizeof(NODE\*)  
e$B$,e(B64bite$B$N$?$a!"e(BNODE\_LMASKe$B$,e(B32bite$B$rD6$($^$9!#e(B  
(3) missing/vsnprintf.ce$B$G;2\>H$5$l$F$$$ke(B\_\_uqtoa()e$B$,IaDL$O$J$5e(B  
e$B$=$&$G$9!#e(B

# Index: intern.h

RCS file: /home/cvs/ruby/intern.h,v  
retrieving revision 1.196  
diff -u -1 -p -r1.196 intern.h  
— intern.h 11 Jul 2006 06:47:08 -0000 1.196  
+++ intern.h 17 Jul 2006 17:08:52 -0000  
@@ -22,2 +22,3 @@  
#endif  
+#include \<st.h\>

# @@ -316,3 +317,3 @@ VALUE rb\_gc\_start(void); /\* hash.c _/ -void st\_foreach\_safe(struct st\_table , int ()(ANYARGS), unsigned long); +void st\_foreach\_safe(struct st\_table , int ()(ANYARGS), st\_data\_t); void rb\_hash\_foreach(VALUE, int (_)(ANYARGS), VALUE); Index: node.h

# RCS file: /home/cvs/ruby/node.h,v retrieving revision 1.75 diff -u -1 -p -r1.75 node.h — node.h 9 Jun 2006 21:20:12 -0000 1.75 +++ node.h 17 Jul 2006 17:08:52 -0000 @@ -168,3 +168,3 @@ typedef struct RNode { #define NODE\_LSHIFT (NODE\_TYPESHIFT+7) -#define NODE\_LMASK (((long)1\<\<(sizeof(NODE\*)_CHAR\_BIT-NODE\_LSHIFT))-1) +#define NODE\_LMASK (((SIGNED\_VALUE)1\<\<(sizeof(NODE_)\*CHAR\_BIT-NODE\_LSHIFT))-1) #define nd\_line(n) ((unsigned int)(((RNODE(n))-\>flags\>\>NODE\_LSHIFT)&NODE\_LMASK)) Index: missing/vsnprintf.c

RCS file: /home/cvs/ruby/missing/vsnprintf.c,v  
retrieving revision 1.17  
diff -u -1 -p -r1.17 vsnprintf.c  
— missing/vsnprintf.c 9 Jun 2006 21:20:00 -0000 1.17  
+++ missing/vsnprintf.c 17 Jul 2006 17:08:52 -0000  
@@ -351,2 +351,68 @@ BSD\_\_sbprintf(register FILE \*fp, const c

+#ifdef _HAVE\_SANE\_QUAD_  
+/\*

- 
  - Convert an unsigned long long to ASCII for printf purposes,  
returning

- 
  - a pointer to the first character of the string representation.

- 
  - Octal numbers can be forced to have a leading zero; hex numbers

- 
  - use the given digits.

- \*/  
+static char \*  
+BSD\_\_uqtoa(register u\_quad\_t val, char \*endp, int base, int octzero,  
char \*xdigs)  
+{
- register char \*cp = endp;
- register long sval;
- 
- /\*
- 
  - Handle the three cases separately, in the hope of getting

- 
  - better/faster code.

- \*/
- switch (base) {
- case 10:
- 

```
  if (val < 10) {	/* many numbers are 1 digit */

```

- 

```
  	*--cp = to_char(val);

```

- 

```
  	return (cp);

```

- 

```
  }

```

- 

```
  /*

```

- 

```
   * On many machines, unsigned arithmetic is harder than

```

- 

```
   * signed arithmetic, so we do at most one unsigned mod and

```

- 

```
   * divide; this is sufficient to reduce the range of

```

- 

```
   * the incoming value to where signed arithmetic works.

```

- 

```
   */

```

- 

```
  if (val > LLONG_MAX) {

```

- 

```
  	*--cp = to_char(val % 10);

```

- 

```
  	sval = val / 10;

```

- 

```
  } else

```

- 

```
  	sval = val;

```

- 

```
  do {

```

- 

```
  	*--cp = to_char(sval % 10);

```

- 

```
  	sval /= 10;

```

- 

```
  } while (sval != 0);

```

- 

```
  break;

```

- 
- case 8:
- 

```
  do {

```

- 

```
  	*--cp = to_char(val & 7);

```

- 

```
  	val >>= 3;

```

- 

```
  } while (val);

```

- 

```
  if (octzero && *cp != '0')

```

- 

```
  	*--cp = '0';

```

- 

```
  break;

```

- 
- case 16:
- 

```
  do {

```

- 

```
  	*--cp = xdigs[val & 15];

```

- 

```
  	val >>= 4;

```

- 

```
  } while (val);

```

- 

```
  break;

```

- 
- default: /\* oops \*/
- 

```
  /*

```

- 

```
  abort();

```

- 

```
  */

```

- 

```
  break;	/* fjc 7-31-97. Don't reference abort() here */

```

- }
- return (cp);  
+}  
+#endif /\* _HAVE\_SANE\_QUAD_ \*/
- 

/\*  
@@ -869,3 +935,3 @@ number: if ((dprec = prec) \>= 0)  
if (uqval != 0 || prec != 0)

- 

```
  			cp = __uqtoa(uqval, cp, base,

```

- 

```
  			cp = BSD__uqtoa(uqval, cp, base,
  			    flags & ALT, xdigs);

```

e$B$=$l$G$O!#e(B

---

<div class="post-metadata">

**Author:** ![U.Nakamura](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/b5ac83/32.png) [@U.Nakamura](https://www.ruby-forum.com/u/U.Nakamura)\
**Post date:** [July 18, 2006, 8:07am UTC](https://www.ruby-forum.com/t/another-llp64-problems/98717/2 "2006-07-18T08:07:20Z")

</div>

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:29045] another LLP64 problems”  
on Tue, 18 Jul 2006 02:11:43 +0900, “U.Nakamura”  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

|FIX2LONGe$B\<~$j$NOC$r=|$1$P!"e(BIL32LLP64e$BBP1~$NLdBjE@$Oe(B(e$B$?$V$se(B)e$B$3$le(B  
|e$B$,:G8e$G$9!#e(B  
|  
|(1) e$BA0$K$bEj$2$?5$$,$7$^$9$,!"e(Bintern.he$B$Ne(Bst\_foreach\_safe()e$B$N@ke(B  
| e$B8@$,Dj5A$H0[$J$j$^$9!#e(B  
|(2) sizeof(NODE\*) e$B$,e(B64bite$B$N$?$a!"e(BNODE\_LMASKe$B$,e(B32bite$B$rD6$($^$9!#e(B  
|(3) missing/vsnprintf.ce$B$G;2\>H$5$l$F$$$ke(B\_\_uqtoa()e$B$,IaDL$O$J$5e(B  
| e$B$=$&$G$9!#e(B

e$B%3%\_%C%H$7$F$/$@$5$$!#e(B
