Memset function of understanding

val_init void (void)
{
    unsigned int I, len;

    len = the sizeof (GF_cs) / the sizeof (GF_cs [0]); // calculate the length of the array GF_cs injection GF_cs global variables, is defined as: unsigned int GF_cs [33] ;
        // clear the memory function -------- Memset vs for memory clean-up loop
        //memset:3496.25us - 3390.50us = 105.75us = 423 instructions (4Mhz)
        // for: 3390.50us - = 158.75 3231.75us us = 635 instructions (4Mhz)
    the NOP (); // measure time 3231.75us -----
    for (I = 0; I <len; I ++)
        GF_cs [I] = 0;
    the NOP (); // time calculation 3390.50us -----
    Memset (GF_cs, 0, the sizeof (GF_cs)); // the address of the start point GF_cs, zero-padded to the memory array within GF_cs length
    NOP (); // --- measure time --3496.25us
}

Guess you like

Origin www.cnblogs.com/inlod/p/11722418.html