This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gsubr.c: C << operator question.



 I'm still learning C as well as scheme.  Can someone help me
 understand this bit of code, please?

In guile-core/libguile/gsubr.c:84, it goes:

      long tmp = ((((SCM_CELLPTR)(SCM_CAR(symcell)))-scm_heap_org)<<8);
      if (SCM_GSUBR_MAX < req + opt + rst) {
	fputs("ERROR in scm_make_gsubr: too many args\n", stderr);
	exit (1);
      }
      if ((tmp>>8) != ((SCM_CELLPTR)(SCM_CAR(symcell))-scm_heap_org))
	tmp = 0;

 ... Why does it first << 8 and then right away do >> 8, recompute and
 compare like that?  How could the value change?