Re: 2.1.109 on Alpha UDB

Stefan Traby (stefan@sime.com)
Sat, 18 Jul 1998 23:14:12 +0200


Hi Steven !

> > > memsetw
> > > memsetw_io

> I'm fairly comfortable with memsetw_io. For the "standard" flavor of
> memset, I erred on the side of caution and coded it to (hopefully) handle
> counts which do not divide evenly into quadword increments. I'm not sure
> if this is necessary.

No no no no no no no no no no no no no !

> +void _memsetw(u16 *dst, u16 c, unsigned long count)
> +{
> + unsigned long lc = c;
> + unsigned long quadword = lc<<24 | lc<<16 | lc<<8 | lc;

???? you use quadword as second argument for memset, memset expects
a char !

> + unsigned long quadcount = count / 4;
> + unsigned long wordcount = (count % 4) / 2;
> +
> + memset(dst, quadword, quadcount);
> + dst += quadcount;
> +
> + while (wordcount)
> + {
> + wordcount--;
> + *((u16)dst)++ = c;

casting a pointer to unsigned short (!!!) and using the
ushort value like *ushort (without casting to a pointer type).
This simply can't work. I'm shure it wouldn't even compile.

> + }
> +}
>
>

-- 
  ciao - 
    Stefan

Stefan Traby phone: +43-3133-6107-2 Mitterlasznitzstr. 13 fax: +43-3133-6107-9 8302 Nestelbach mailto://stefan@sime.com Austria

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html