Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: monnier@di.epfl.ch (Stefan Monnier)
Subject: Re: emacs-19.24 being ported to alpha ?
Date: 1 Jun 1994 05:09:20 GMT	[thread overview]
Message-ID: <2sh560$ivv@info.epfl.ch> (raw)
In-Reply-To: mos.770413214@ruunat.fys.ruu.nl

In article <mos.770413214@ruunat.fys.ruu.nl>, Henk Mos <mos@fys.ruu.nl> wrote:
> Yes, I had the same problem. There is a bitshift problem with the
> float-to-int conversion in floatfns.c. Compiling with gcc will show the
> warnings.
> floatfns.c has a lot of changes compared to 19.22 but I closed my eyes
> and replaced it with the 19.22 version and recompiled. 
> Everything (including scrollbar) works fine now.

Another "solution" is to correct the bitshifts.
The problem is pretty simple (as explained by gcc): the shift is too
big for the data type. Actually the reason it is too big is because
it's done on a constant "1" which is considered as int, whereas the
shift assumes it is a long. Replacing it with "1L" tells the compiler
it's a long. I also changed the subsequent cast to int into a cast to
long.. don't know if it helps or hurts or does nothing, but...

The scrollbars seem to work now, at least.

The floatfns.c file looks like this now (from line 178):

--------------------------------------------------------------------
...
/* Convert float to Lisp_Int if it fits, else signal a range error
   using the given arguments.  */
#define FLOAT_TO_INT(x, i, name, num)					\
  do									\
    {									\
      if ((x) >= (1L << (VALBITS-1)) || (x) <= - (1L << (VALBITS-1)) - 1)	\
	range_error (name, num);					\
      XSET (i, Lisp_Int,  (long)(x));					\
    }									\
  while (0)
#define FLOAT_TO_INT2(x, i, name, num1, num2)				\
  do									\
    {									\
      if ((x) >= (1L << (VALBITS-1)) || (x) <= - (1L << (VALBITS-1)) - 1)	\
	range_error2 (name, num1, num2);				\
      XSET (i, Lisp_Int,  (long)(x));					\
    }									\
  while (0)
...
---------------------------------------------------------------------

I don't feel very comfortable with that fix (probably because it's not
really portable as far as I know), but it works on my alpha, so I'm
happy.


	Stefan


      reply	other threads:[~1994-06-01  5:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <KOL.94May31084452@mirage.nta.no>
1994-05-31  9:05 ` emacs-19.24 being ported? Andreas Manessinger
1994-05-31 12:49   ` L.Rosenthaler
1994-05-31 13:20     ` Karl Olav Lillevold
1994-05-31 19:40       ` Henk Mos
1994-06-01  5:09         ` Stefan Monnier [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox