summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/varbit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/varbit.c')
-rw-r--r--src/backend/utils/adt/varbit.c60
1 files changed, 40 insertions, 20 deletions
diff --git a/src/backend/utils/adt/varbit.c b/src/backend/utils/adt/varbit.c
index 73e2a05845..d847611240 100644
--- a/src/backend/utils/adt/varbit.c
+++ b/src/backend/utils/adt/varbit.c
@@ -29,7 +29,9 @@ static VarBit *bitsubstring(VarBit *arg, int32 s, int32 l,
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)
{
@@ -64,7 +66,9 @@ 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)
{
@@ -233,8 +237,10 @@ bit_out(PG_FUNCTION_ARGS)
/* 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;
@@ -330,7 +336,8 @@ bit_send(PG_FUNCTION_ARGS)
return varbit_send(fcinfo);
}
-/* bit()
+/*
+ * bit()
* Converts a bit() type to a specific internal length.
* len is the bitlength specified in the column definition.
*
@@ -523,7 +530,8 @@ varbit_in(PG_FUNCTION_ARGS)
PG_RETURN_VARBIT_P(result);
}
-/* varbit_out -
+/*
+ * varbit_out -
* Prints the string as bits to preserve length accurately
*/
Datum
@@ -636,7 +644,8 @@ varbit_send(PG_FUNCTION_ARGS)
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.
*
@@ -718,7 +727,8 @@ varbittypmodout(PG_FUNCTION_ARGS)
* 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
@@ -871,7 +881,8 @@ bitcmp(PG_FUNCTION_ARGS)
PG_RETURN_INT32(result);
}
-/* bitcat
+/*
+ * bitcat
* Concatenation of bit strings
*/
Datum
@@ -931,7 +942,8 @@ bit_catenate(VarBit *arg1, VarBit *arg2)
return result;
}
-/* bitsubstr
+/*
+ * bitsubstr
* retrieve a substring from the bit string.
* Note, s is 1-based.
* SQL draft 6.10 9)
@@ -1105,7 +1117,8 @@ bit_overlay(VarBit *t1, VarBit *t2, int sp, int sl)
return result;
}
-/* bitlength, bitoctetlength
+/*
+ * bitlength, bitoctetlength
* Return the length of a bit string
*/
Datum
@@ -1124,11 +1137,12 @@ bitoctetlength(PG_FUNCTION_ARGS)
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);
@@ -1164,11 +1178,12 @@ bitand(PG_FUNCTION_ARGS)
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);
@@ -1210,7 +1225,8 @@ bitor(PG_FUNCTION_ARGS)
PG_RETURN_VARBIT_P(result);
}
-/* bitxor
+/*
+ * bitxor
* perform a logical XOR on two bit strings.
*/
Datum
@@ -1257,7 +1273,8 @@ bitxor(PG_FUNCTION_ARGS)
PG_RETURN_VARBIT_P(result);
}
-/* bitnot
+/*
+ * bitnot
* perform a logical NOT on a bit string.
*/
Datum
@@ -1289,7 +1306,8 @@ bitnot(PG_FUNCTION_ARGS)
PG_RETURN_VARBIT_P(result);
}
-/* bitshiftleft
+/*
+ * bitshiftleft
* do a left shift (i.e. towards the beginning of the string)
*/
Datum
@@ -1348,7 +1366,8 @@ bitshiftleft(PG_FUNCTION_ARGS)
PG_RETURN_VARBIT_P(result);
}
-/* bitshiftright
+/*
+ * bitshiftright
* do a right shift (i.e. towards the end of the string)
*/
Datum
@@ -1575,7 +1594,8 @@ bittoint8(PG_FUNCTION_ARGS)
}
-/* 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.