On Fri, 5 Apr 2002, Edward J Glamkowski wrote: >So, I'm adding some classes and it hits me: >can't find_class_bitvector() be written as: > >long find_class_bitvector(char arg) >{ > int c = parse_class(arg); > > return (c != CLASS_UNDEFINED ? (1 << c) : 0); >} Since that function is always used in a loop, it makes more sense to do: bitvector_t find_class_bitvector(const char *arg) { size_t rpos, ret = 0; for (rpos = 0; rpos < strlen(arg); rpos++) ret |= (1 << parse_class(arg[rpos])); return (ret); } Then the code in act.informative.c doesn't have to loop. -- George Greer greerga@circlemud.org -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT