- g_string_append_printf(*out, "%d%c",
- (int)((sample & (1 << j)) >> j),
- ctx->separator);
+ p = logic->data + i + j / 8;
+ c = *p & (1 << (j % 8));
+ g_string_append_c(*out, c ? '1' : '0');
+ g_string_append_c(*out, ctx->separator);
+ }
+ if (i && j) {
+ /* Drop last separator. */
+ g_string_truncate(*out, (*out)->len - 1);