GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
address.c File Reference

Address routines. More...

#include "local_proto.h"
Include dependency graph for address.c:

Go to the source code of this file.

Macros

#define SEG_N_ROW_NONZERO(SEG, row, col)   (((row) >> (SEG)->srowbits) * (SEG)->spr + ((col) >> (SEG)->scolbits))
 
#define SEG_INDEX_ROW_NONZERO(SEG, row, col)   ((((row) & ((SEG)->srows - 1)) << (SEG)->scolbits) + ((col) & ((SEG)->scols - 1)))
 
#define SEG_N_ROW_ZERO(SEG, col)   ((col) >> (SEG)->scolbits)
 
#define SEG_INDEX_ROW_ZERO(SEG, col)   ((col) & ((SEG)->scols - 1))
 
#define INDEX_ADJ(SEG, i)   ((SEG)->fast_seek ? ((i) << (SEG)->lenbits) : ((i) * (SEG)->len))
 

Functions

int seg_address_fast (const SEGMENT *SEG, off_t row, off_t col, int *n, int *index)
 
int seg_address_slow (const SEGMENT *SEG, off_t row, off_t col, int *n, int *index)
 
int seg_address (const SEGMENT *SEG, off_t row, off_t col, int *n, int *index)
 Internal use only. More...
 

Detailed Description

Address routines.

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
GRASS GIS Development Team
Date
2005-2009

Definition in file address.c.

Macro Definition Documentation

◆ INDEX_ADJ

#define INDEX_ADJ (   SEG,
 
)    ((SEG)->fast_seek ? ((i) << (SEG)->lenbits) : ((i) * (SEG)->len))

Definition at line 27 of file address.c.

Referenced by seg_address_fast().

◆ SEG_INDEX_ROW_NONZERO

#define SEG_INDEX_ROW_NONZERO (   SEG,
  row,
  col 
)    ((((row) & ((SEG)->srows - 1)) << (SEG)->scolbits) + ((col) & ((SEG)->scols - 1)))

Definition at line 20 of file address.c.

Referenced by seg_address_fast().

◆ SEG_INDEX_ROW_ZERO

#define SEG_INDEX_ROW_ZERO (   SEG,
  col 
)    ((col) & ((SEG)->scols - 1))

Definition at line 25 of file address.c.

Referenced by seg_address_fast().

◆ SEG_N_ROW_NONZERO

#define SEG_N_ROW_NONZERO (   SEG,
  row,
  col 
)    (((row) >> (SEG)->srowbits) * (SEG)->spr + ((col) >> (SEG)->scolbits))

Definition at line 17 of file address.c.

Referenced by seg_address_fast().

◆ SEG_N_ROW_ZERO

#define SEG_N_ROW_ZERO (   SEG,
  col 
)    ((col) >> (SEG)->scolbits)

Definition at line 23 of file address.c.

Referenced by seg_address_fast().

Function Documentation

◆ seg_address()

int seg_address ( const SEGMENT SEG,
off_t  row,
off_t  col,
int *  n,
int *  index 
)

Internal use only.

Gets segment address and setsn and index.

Parameters
[in]SEGsegment
[in]row
[in]col
[in,out]n
[in,out]index
Returns
always returns 0

Definition at line 107 of file address.c.

References SEGMENT::address.

◆ seg_address_fast()

int seg_address_fast ( const SEGMENT SEG,
off_t  row,
off_t  col,
int *  n,
int *  index 
)

◆ seg_address_slow()

int seg_address_slow ( const SEGMENT SEG,
off_t  row,
off_t  col,
int *  n,
int *  index 
)

Definition at line 73 of file address.c.

References SEGMENT::len, SEGMENT::scols, SEGMENT::spr, and SEGMENT::srows.

Referenced by seg_setup().