comparison src/bytecode.c @ 1104:8b464283e891

[xemacs-hg @ 2002-11-12 18:58:13 by james] Unconditionally compile the LISP_FLOAT_TYPE code. Remove all !LISP_FLOAT_TYPE code and the LISP_FLOAT_TYPE identifier itself.
author james
date Tue, 12 Nov 2002 18:58:41 +0000
parents c925bacdda60
children a123f88fa975
comparison
equal deleted inserted replaced
1103:80d9ab2e9855 1104:8b464283e891
245 bytecode_negate (Lisp_Object obj) 245 bytecode_negate (Lisp_Object obj)
246 { 246 {
247 retry: 247 retry:
248 248
249 if (INTP (obj)) return make_int (- XINT (obj)); 249 if (INTP (obj)) return make_int (- XINT (obj));
250 #ifdef LISP_FLOAT_TYPE
251 if (FLOATP (obj)) return make_float (- XFLOAT_DATA (obj)); 250 if (FLOATP (obj)) return make_float (- XFLOAT_DATA (obj));
252 #endif
253 if (CHARP (obj)) return make_int (- ((int) XCHAR (obj))); 251 if (CHARP (obj)) return make_int (- ((int) XCHAR (obj)));
254 if (MARKERP (obj)) return make_int (- ((int) marker_position (obj))); 252 if (MARKERP (obj)) return make_int (- ((int) marker_position (obj)));
255 253
256 obj = wrong_type_argument (Qnumber_char_or_marker_p, obj); 254 obj = wrong_type_argument (Qnumber_char_or_marker_p, obj);
257 goto retry; 255 goto retry;
281 static int 279 static int
282 bytecode_arithcompare (Lisp_Object obj1, Lisp_Object obj2) 280 bytecode_arithcompare (Lisp_Object obj1, Lisp_Object obj2)
283 { 281 {
284 retry: 282 retry:
285 283
286 #ifdef LISP_FLOAT_TYPE
287 { 284 {
288 EMACS_INT ival1, ival2; 285 EMACS_INT ival1, ival2;
289 286
290 if (INTP (obj1)) ival1 = XINT (obj1); 287 if (INTP (obj1)) ival1 = XINT (obj1);
291 else if (CHARP (obj1)) ival1 = XCHAR (obj1); 288 else if (CHARP (obj1)) ival1 = XCHAR (obj1);
325 goto retry; 322 goto retry;
326 } 323 }
327 324
328 return dval1 < dval2 ? -1 : dval1 > dval2 ? 1 : 0; 325 return dval1 < dval2 ? -1 : dval1 > dval2 ? 1 : 0;
329 } 326 }
330 #else /* !LISP_FLOAT_TYPE */
331 {
332 EMACS_INT ival1, ival2;
333
334 if (INTP (obj1)) ival1 = XINT (obj1);
335 else if (CHARP (obj1)) ival1 = XCHAR (obj1);
336 else if (MARKERP (obj1)) ival1 = marker_position (obj1);
337 else
338 {
339 obj1 = wrong_type_argument (Qnumber_char_or_marker_p, obj1);
340 goto retry;
341 }
342
343 if (INTP (obj2)) ival2 = XINT (obj2);
344 else if (CHARP (obj2)) ival2 = XCHAR (obj2);
345 else if (MARKERP (obj2)) ival2 = marker_position (obj2);
346 else
347 {
348 obj2 = wrong_type_argument (Qnumber_char_or_marker_p, obj2);
349 goto retry;
350 }
351
352 return ival1 < ival2 ? -1 : ival1 > ival2 ? 1 : 0;
353 }
354 #endif /* !LISP_FLOAT_TYPE */
355 } 327 }
356 328
357 static Lisp_Object 329 static Lisp_Object
358 bytecode_arithop (Lisp_Object obj1, Lisp_Object obj2, Opcode opcode) 330 bytecode_arithop (Lisp_Object obj1, Lisp_Object obj2, Opcode opcode)
359 { 331 {
360 #ifdef LISP_FLOAT_TYPE
361 EMACS_INT ival1, ival2; 332 EMACS_INT ival1, ival2;
362 int float_p; 333 int float_p;
363 334
364 retry: 335 retry:
365 336
417 case Bmax: if (dval1 < dval2) dval1 = dval2; break; 388 case Bmax: if (dval1 < dval2) dval1 = dval2; break;
418 case Bmin: if (dval1 > dval2) dval1 = dval2; break; 389 case Bmin: if (dval1 > dval2) dval1 = dval2; break;
419 } 390 }
420 return make_float (dval1); 391 return make_float (dval1);
421 } 392 }
422 #else /* !LISP_FLOAT_TYPE */
423 EMACS_INT ival1, ival2;
424
425 retry:
426
427 if (INTP (obj1)) ival1 = XINT (obj1);
428 else if (CHARP (obj1)) ival1 = XCHAR (obj1);
429 else if (MARKERP (obj1)) ival1 = marker_position (obj1);
430 else
431 {
432 obj1 = wrong_type_argument (Qnumber_char_or_marker_p, obj1);
433 goto retry;
434 }
435
436 if (INTP (obj2)) ival2 = XINT (obj2);
437 else if (CHARP (obj2)) ival2 = XCHAR (obj2);
438 else if (MARKERP (obj2)) ival2 = marker_position (obj2);
439 else
440 {
441 obj2 = wrong_type_argument (Qnumber_char_or_marker_p, obj2);
442 goto retry;
443 }
444
445 switch (opcode)
446 {
447 case Bplus: ival1 += ival2; break;
448 case Bdiff: ival1 -= ival2; break;
449 case Bmult: ival1 *= ival2; break;
450 case Bquo:
451 if (ival2 == 0) Fsignal (Qarith_error, Qnil);
452 ival1 /= ival2;
453 break;
454 case Bmax: if (ival1 < ival2) ival1 = ival2; break;
455 case Bmin: if (ival1 > ival2) ival1 = ival2; break;
456 }
457 return make_int (ival1);
458 #endif /* !LISP_FLOAT_TYPE */
459 } 393 }
460 394
461 395
462 /* Read next uint8 from the instruction stream. */ 396 /* Read next uint8 from the instruction stream. */
463 #define READ_UINT_1 ((unsigned int) (unsigned char) *program_ptr++) 397 #define READ_UINT_1 ((unsigned int) (unsigned char) *program_ptr++)