static VarBit *bit_overlay(VarBit *t1, VarBit *t2, int sp, int sl);
-/* common code for bittypmodin and varbittypmodin */
+/*
+ * common code for bittypmodin and varbittypmodin
+ */
static int32
anybit_typmodin(ArrayType *ta, const char *typename)
{
return typmod;
}
-/* common code for bittypmodout and varbittypmodout */
+/*
+ * common code for bittypmodout and varbittypmodout
+ */
static char *
anybit_typmodout(int32 typmod)
{
/* same as varbit output */
return varbit_out(fcinfo);
#else
-/* This is how one would print a hex string, in case someone wants to
- write a formatting function. */
+ /*
+ * This is how one would print a hex string, in case someone wants to
+ * write a formatting function.
+ */
VarBit *s = PG_GETARG_VARBIT_P(0);
char *result,
*r;
return varbit_send(fcinfo);
}
-/* bit()
+/*
+ * bit()
* Converts a bit() type to a specific internal length.
* len is the bitlength specified in the column definition.
*
PG_RETURN_VARBIT_P(result);
}
-/* varbit_out -
+/*
+ * varbit_out -
* Prints the string as bits to preserve length accurately
*/
Datum
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
-/* varbit()
+/*
+ * varbit()
* Converts a varbit() type to a specific internal length.
* len is the maximum bitlength specified in the column definition.
*
* need to be so careful.
*/
-/* bit_cmp
+/*
+ * bit_cmp
*
* Compares two bitstrings and returns <0, 0, >0 depending on whether the first
* string is smaller, equal, or bigger than the second. All bits are considered
PG_RETURN_INT32(result);
}
-/* bitcat
+/*
+ * bitcat
* Concatenation of bit strings
*/
Datum
return result;
}
-/* bitsubstr
+/*
+ * bitsubstr
* retrieve a substring from the bit string.
* Note, s is 1-based.
* SQL draft 6.10 9)
return result;
}
-/* bitlength, bitoctetlength
+/*
+ * bitlength, bitoctetlength
* Return the length of a bit string
*/
Datum
PG_RETURN_INT32(VARBITBYTES(arg));
}
-/* bitand
+/*
+ * bit_and
* perform a logical AND on two bit strings.
*/
Datum
-bitand(PG_FUNCTION_ARGS)
+bit_and(PG_FUNCTION_ARGS)
{
VarBit *arg1 = PG_GETARG_VARBIT_P(0);
VarBit *arg2 = PG_GETARG_VARBIT_P(1);
PG_RETURN_VARBIT_P(result);
}
-/* bitor
+/*
+ * bit_or
* perform a logical OR on two bit strings.
*/
Datum
-bitor(PG_FUNCTION_ARGS)
+bit_or(PG_FUNCTION_ARGS)
{
VarBit *arg1 = PG_GETARG_VARBIT_P(0);
VarBit *arg2 = PG_GETARG_VARBIT_P(1);
PG_RETURN_VARBIT_P(result);
}
-/* bitxor
+/*
+ * bitxor
* perform a logical XOR on two bit strings.
*/
Datum
PG_RETURN_VARBIT_P(result);
}
-/* bitnot
+/*
+ * bitnot
* perform a logical NOT on a bit string.
*/
Datum
PG_RETURN_VARBIT_P(result);
}
-/* bitshiftleft
+/*
+ * bitshiftleft
* do a left shift (i.e. towards the beginning of the string)
*/
Datum
PG_RETURN_VARBIT_P(result);
}
-/* bitshiftright
+/*
+ * bitshiftright
* do a right shift (i.e. towards the end of the string)
*/
Datum
}
-/* Determines the position of S2 in the bitstring S1 (1-based string).
+/*
+ * Determines the position of S2 in the bitstring S1 (1-based string).
* If S2 does not appear in S1 this function returns 0.
* If S2 is of length 0 this function returns 1.
* Compatible in usage with POSITION() functions for other data types.
extern Datum bitgt(PG_FUNCTION_ARGS);
extern Datum bitge(PG_FUNCTION_ARGS);
extern Datum bitcmp(PG_FUNCTION_ARGS);
-extern Datum bitand(PG_FUNCTION_ARGS);
-extern Datum bitor(PG_FUNCTION_ARGS);
+/* avoid the names bitand and bitor, since they are C++ keywords */
+extern Datum bit_and(PG_FUNCTION_ARGS);
+extern Datum bit_or(PG_FUNCTION_ARGS);
extern Datum bitxor(PG_FUNCTION_ARGS);
extern Datum bitnot(PG_FUNCTION_ARGS);
extern Datum bitshiftleft(PG_FUNCTION_ARGS);