9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: tlaronde@polynum.com
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] BUG!!! in Plan9 compiler!
Date: Thu, 22 Apr 2010 19:50:33 +0200	[thread overview]
Message-ID: <20100422175033.GA6247@polynum.com> (raw)
In-Reply-To: <20100422173640.GA4148@polynum.com>

Oups, I sent the version with the modifications applied (enrolling).
Here is the vanilla version (with reformating):

void
makemoves( scaled xx0 , scaled xx1 , scaled xx2 , scaled xx3 ,
	scaled yy0 , scaled yy1 , scaled yy2 , scaled yy3 ,
	smallnumber xicorr , smallnumber etacorr )
{/* 22 30 10 */ integer x1, x2, x3, m, r, y1, y2, y3, n, s, l  ;
  integer q, t, u, x2a, x3a, y2a, y3a  ;

  if ( ( xx3 < xx0 ) || ( yy3 < yy0 ) )
  	confusion ( 109 ) ;
  l = 16 ;
  bisectptr = 0 ;
  x1 = xx1 - xx0 ;
  x2 = xx2 - xx1 ;
  x3 = xx3 - xx2 ;
  if ( xx0 >= xicorr )
  	r = ( xx0 - xicorr ) % 65536L ;
  else
	r = 65535L - ( ( - (integer) xx0 + xicorr - 1 ) % 65536L ) ;

  m = ( xx3 - xx0 + r ) / 65536L ;
  y1 = yy1 - yy0 ;
  y2 = yy2 - yy1 ;
  y3 = yy3 - yy2 ;
  if ( yy0 >= etacorr )
  	s = ( yy0 - etacorr ) % 65536L ;
  else
	s = 65535L - ( ( - (integer) yy0 + etacorr - 1 ) % 65536L ) ;
  n = ( yy3 - yy0 + s ) / 65536L ;

  if ( ( xx3 - xx0 >= 268435456L ) || ( yy3 - yy0 >= 268435456L ) ) {
		x1 = half ( x1 + xicorr ) ;
		x2 = half ( x2 + xicorr ) ;
		x3 = half ( x3 + xicorr ) ;
		r = half ( r + xicorr ) ;
		y1 = half ( y1 + etacorr ) ;
		y2 = half ( y2 + etacorr ) ;
		y3 = half ( y3 + etacorr ) ;
		s = half ( s + etacorr ) ;
		l = 15 ;
  }

  while ( true ) {
    lab22:
	if ( m == 0 ) {
		while ( n > 0 ) {
			incr ( moveptr ) ;
			move [ moveptr ] = 1 ;
			decr ( n ) ;
		}
	} else if ( n == 0 )
   		move [ moveptr ] = move [ moveptr ] + m ;
   	else if ( m + n == 2 ) {
			r = twotothe [ l ] - r ;
			s = twotothe [ l ] - s ;
			while ( l < 30 ) {
				x3a = x3 ;
				x2a = half ( x2 + x3 + xicorr ) ;
				x2 = half ( x1 + x2 + xicorr ) ;
				x3 = half ( x2 + x2a + xicorr ) ;
				t = x1 + x2 + x3 ;
				r = r + r - xicorr ;
				y3a = y3 ;
				y2a = half ( y2 + y3 + etacorr ) ;
				y2 = half ( y1 + y2 + etacorr ) ;
				y3 = half ( y2 + y2a + etacorr ) ;
				u = y1 + y2 + y3 ;
				s = s + s - etacorr ;
				if ( t < r ) {
					if ( u < s ) {
					  x1 = x3 ;
					  x2 = x2a ;
					  x3 = x3a ;
					  r = r - t ;
					  y1 = y3 ;
					  y2 = y2a ;
					  y3 = y3a ;
					  s = s - u ;
					}
				} else {
					  {
					    incr ( moveptr ) ;
					    move [ moveptr ] = 2 ;
					  }
					  goto lab30 ;
				} else if ( u < s ) {
					  {
					    incr ( move [ moveptr ] ) ;
					    incr ( moveptr ) ;
					    move [ moveptr ] = 1 ;
					  }
					  goto lab30 ;
				}
				incr ( l ) ;
			}  /* end while */
			r = r - xicorr ;
			s = s - etacorr ;
			if ( abvscd ( x1 + x2 + x3 , s , y1 + y2 + y3 , r ) - xicorr >= 0 ) {
				incr ( move [ moveptr ] ) ;
				incr ( moveptr ) ;
				move [ moveptr ] = 1 ;
			} else {
					incr ( moveptr ) ;
					move [ moveptr ] = 2 ;
				}
			lab30: ;
	} else {	/* The problem arises in this branch */
      incr ( l ) ;
      bisectstack [ bisectptr + 10 ] = l ;
      bisectstack [ bisectptr + 2 ] = x3 ;
      bisectstack [ bisectptr + 1 ] = half ( x2 + x3 + xicorr ) ;
      x2 = half ( x1 + x2 + xicorr ) ;
      x3 = half ( x2 + bisectstack [ bisectptr + 1 ] + xicorr ) ;
      bisectstack [ bisectptr ] = x3 ;
      r = r + r + xicorr ;
      t = x1 + x2 + x3 + r ;
      q = t / twotothe [ l ] ;
      bisectstack [ bisectptr + 3 ] = t % twotothe [ l ] ;
      bisectstack [ bisectptr + 4 ] = m - q ;
      m = q ;
      bisectstack [ bisectptr + 7 ] = y3 ;
      bisectstack [ bisectptr + 6 ] = half ( y2 + y3 + etacorr ) ;
      y2 = half ( y1 + y2 + etacorr ) ;
      y3 = half ( y2 + bisectstack [ bisectptr + 6 ] + etacorr ) ;
      bisectstack [ bisectptr + 5 ] = y3 ;
      s = s + s + etacorr ;
      u = y1 + y2 + y3 + s ;
      q = u / twotothe [ l ] ;
      bisectstack [ bisectptr + 8 ] = u % twotothe [ l ] ;
      bisectstack [ bisectptr + 9 ] = n - q ;
      n = q ;
      bisectptr = bisectptr + 11 ;
      goto lab22 ;
    }
    if ( bisectptr == 0 )
    	goto lab10 ;
    bisectptr = bisectptr - 11 ;
    x1 = bisectstack [ bisectptr ] ;
    x2 = bisectstack [ bisectptr + 1 ] ;
    x3 = bisectstack [ bisectptr + 2 ] ;
    r = bisectstack [ bisectptr + 3 ] ;
    m = bisectstack [ bisectptr + 4 ] ;
    y1 = bisectstack [ bisectptr + 5 ] ;
    y2 = bisectstack [ bisectptr + 6 ] ;
    y3 = bisectstack [ bisectptr + 7 ] ;
    s = bisectstack [ bisectptr + 8 ] ;
    n = bisectstack [ bisectptr + 9 ] ;
    l = bisectstack [ bisectptr + 10 ] ;
  } /* end true */
  lab10: ;
}
--
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                      http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C



  reply	other threads:[~2010-04-22 17:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22 15:29 tlaronde
2010-04-22 17:03 ` Bakul Shah
2010-04-22 17:36   ` tlaronde
2010-04-22 17:50     ` tlaronde [this message]
2010-04-22 19:08       ` geoff
2010-04-22 19:32         ` tlaronde
2010-04-22 20:07           ` Bakul Shah
2010-04-22 21:15             ` tlaronde
2010-04-22 21:26               ` tlaronde
2010-04-22 22:49               ` Bakul Shah
2010-04-23  7:42                 ` tlaronde
2010-04-23 18:53                 ` C H Forsyth
2010-04-23 18:51                   ` tlaronde
2010-04-23 20:08                   ` Bakul Shah
2010-04-23 20:46                     ` ron minnich
2010-04-23 21:44                       ` erik quanstrom
2010-04-23 22:34                       ` erik quanstrom
2010-04-24 18:59                         ` Bakul Shah
2010-04-24 21:47                           ` Charles Forsyth
2010-04-25  0:31                           ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100422175033.GA6247@polynum.com \
    --to=tlaronde@polynum.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).