pub fn digitize(a: &mut [i32], nx: usize, ny: usize, scale: i32) {
    /*
     * round to multiple of scale
     */
    if scale <= 1 {
        return;
    };

    let d: i32 = (scale + 1) / 2 - 1;

    if d == 0 {
        // for (p=a; p <= &a[nx*ny-1]; p++) {
        for p in 0..(nx * ny) {
            a[p] /= scale;
        }
    } else {
        for p in 0..(nx * ny) {
            //for (p=a; p <= &a[nx*ny-1]; p++) {
            if a[p] > 0 {
                a[p] = (a[p] + d) / scale;
            } else {
                a[p] = (a[p] - d) / scale;
            }
        }
    }
}
/* digitize.c	digitize H-transform
 *
 * Programmer: R. White		Date: 15 June 1994
 */
digitize.c     digitize H-transform
Programmer: R. White         Date: 15 June 1994
digitize . c digitize H - transform Programmer : R . White Date : 15 June 1994
pub fn digitize(a: &mut [i32], nx: usize, ny: usize, scale: i32) {
    /*
     * round to multiple of scale
     */
    if scale <= 1 {
        return;
    };
    let d: i32 = (scale + 1) / 2 - 1;
    if d == 0 {
        // for (p=a; p <= &a[nx*ny-1]; p++) {
        for p in 0..(nx * ny) {
            a[p] /= scale;
        }
    } else {
        for p in 0..(nx * ny) {
            //for (p=a; p <= &a[nx*ny-1]; p++) {
            if a[p] > 0 {
                a[p] = (a[p] + d) / scale;
            } else {
                a[p] = (a[p] - d) / scale;
            }
        }
    }
}
pub fn digitize ( a : & mut [ i32 ] , nx : usize , ny : usize , scale : i32 ) { /*
     * round to multiple of scale
     */ if scale <= 1 { return ; } ; let d : i32 = ( scale + 1 ) / 2 - 1 ; if d == 0 { // for (p=a; p <= &a[nx*ny-1]; p++) { for p in 0 .. ( nx * ny ) { a [ p ] /= scale ; } } else { for p in 0 .. ( nx * ny ) { //for (p=a; p <= &a[nx*ny-1]; p++) { if a [ p ] > 0 { a [ p ] = ( a [ p ] + d ) / scale ; } else { a [ p ] = ( a [ p ] - d ) / scale ; } } } }
digitize.c     digitize H-transform
 Programmer: R. White         Date: 15 June 1994
digitize . c digitize H - transform Programmer : R . White Date : 15 June 1994
a
&mut [i32]
nx
usize
ny
usize
scale
i32
a
&mut [i32]
nx
usize
ny
usize
scale
i32