distinct_array.c

ds2.1.1/lib/secure/sefun/distinct_array.c · 349 B

From the archive ds2.1.1.zip

Download the archive   « Back to the archive contents

//    /adm/simul_efun/distinct_array.c
//    from Dead Souls
//    a faster, better namedfunction based on Huthar's uniq_array()
//    by Descartes of Borg 940117

mixed *distinct_array(mixed *arr) {
    mapping tmp;
    int i, maxi;

    for(i = 0, tmp = allocate_mapping(maxi = sizeof(arr)); i<maxi; i++)
	tmp[arr[i]] = 1;
    return keys(tmp);
}

Site Stats

Snippets: 1791
Codebases: 571