Unix Technical Forum

varbit functions

This is a discussion on varbit functions within the Pgsql General forums, part of the PostgreSQL category; --> I'm using bit and bit varying datatypes to store chemical "fingerprints" and need various functions to operate on these ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 08:23 PM
TJ O'Donnell
 
Posts: n/a
Default varbit functions

I'm using bit and bit varying datatypes to store chemical
"fingerprints" and need various functions to operate on
these datatypes. The logical operators (and, or, not)
and the shift operators, as well as length and octet-length
all work fine on bit types. I was hoping for a manual entry
that specifically discusses functions for bit and bit varying,
like the one for dates, strings, etc. Does anyone know of such
a manual entry? I see bits (no pun intended) of info scattered
around. \df helps some too. I'll consider writing such an entry
unless someone can point me to something existing.

So, the functions I need are (at least):

int nbits_set(bit) ;to count # of bits set in the string.
void bit_set(bit, int) ;to set a particular bit in a string.
bool isbit_set(bit) ;to test whether a particular bit is set.

I've already written nbits_set (in c) and could write the others,
but I want to ask if functions like these already exist (and I
just can't find them)? Does anyone have any ideas about how to
use combinations of existing functions (shifts, ands, etc.) to do
these functions? The bit strings I am interested in range from
20 to maybe 1024.

TJ

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:40 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com