Daylight v4.9
Release Date: 1 February 2008

Name

dt_fp_setrange - set a range of bitvalues in a fingerprint

Generic Prototype

dt_fp_setrange(dt_Handle, dt_Integer, dt_String, dt_Integer, dt_Integer) =>
dt_Integer

C Prototype

#include "dt_finger.h"

dt_Integer dt_fp_setrange(dt_Handle fp, dt_Integer offset, dt_Integer nbits, dt_Integer slen, dt_String string, dt_Integer soffset, dt_Integer operation)

FORTRAN Prototype

include 'dt_f_finger.inc'

integer*4 dt_f_fp_setrange(fp, offset, nbits, string, soffset, operation)

integer*4 fp
integer*4 offset
integer*4 nbits
character*() string
integer*4 soffset
integer*4 operation

Description

Sets a range of bitvalues in the fingerprint. 'offset' is the starting bit number target in the fingerprint for the copy. 'nbits' is the desired number of bits to copy. The string is the source of bits for the copy, and 'soffset' is the bit number source in the string from where the bits are taken for the copy.

The function truncates the copied string as appropriate, and prevents overflow of the target fingerprint. Hence, the number of bits actually copied will be the lesser of:

1. nbits: the number of bits given as an argument to the function,

2. (dt_fp_nbits(fp) - offset): the number of bits available in the fingerprint from the offset to the end of the fingerprint,

3. ((slen * 8) - soffset): the number of bits available in the string to actually copy after the string offset to the end of the string.

The 'operation' argument controls the bitwise operation performed when a bit is set in the fingerprint. The following values are legal:

DX_FP_SET

Sets each target fingerprint bitvalue to the source value.
DX_FP_NOT
Sets each target fingerprint bitvalue to the inverse of the source value.
DX_FP_OR
Sets each target bitvalue to the logical 'or' of the current fingerprint bitvalue and the source bitvalue.
DX_FP_AND
Sets each target bitvalue to the logical 'and' of the current fingerprint bitvalue and the source bitvalue.
DX_FP_XOR
Sets each target bitvalue to the logical exclusive-or of the current fingerprint bitvalue and the source bitvalue.

Return Value

Returns the number of bits set. Returns (-1) for inappropriate objects.

Related Topics

dt_fp_allocfp(3) dt_fp_bitcount(3) dt_fp_bitvalue(3) dt_fp_euclid(3) dt_fp_fingertest(3) dt_fp_foldfp(3) dt_fp_generatefp(3) dt_fp_nbits(3) dt_fp_obitcount(3) dt_fp_obits(3) dt_fp_range(3) dt_fp_setbitvalue(3) dt_fp_setobitcount(3) dt_fp_setobits(3) dt_fp_tanimoto(3) dt_fp_tversky(3)