int BN_set_bit(BIGNUM *a, int n)
{
    int i, j, k;
    if (n < 0)
        return 0;
    i = n / BN_BITS2;
    j = n % BN_BITS2;
    if (a->top <= i) {
        if (bn_wexpand(a, i + 1) == NULL)
            return (0);
        for (k = a->top; k < i + 1; k++)
            a->d[k] = 0;
        a->top = i + 1;
    }
    a->d[i] |= (((BN_ULONG)1) << j);
    bn_check_top(a);
    return (1);
}
['static int test_sub()\n{\n    BIGNUM *a, *b, *c;\n    int i;\n    a = BN_new();\n    b = BN_new();\n    c = BN_new();\n    for (i = 0; i < NUM0 + NUM1; i++) {\n        if (i < NUM1) {\n            BN_bntest_rand(a, 512, 0, 0);\n            BN_copy(b, a);\n            if (BN_set_bit(a, i) == 0)\n                return 0;\n            BN_add_word(b, i);\n        } else {\n            BN_bntest_rand(b, 400 + i - NUM1, 0, 0);\n            a->neg = rand_neg();\n            b->neg = rand_neg();\n        }\n        BN_sub(c, a, b);\n        BN_add(c, c, b);\n        BN_sub(c, c, a);\n        if (!BN_is_zero(c)) {\n            printf("Subtract test failed!\\n");\n            return 0;\n        }\n    }\n    BN_free(a);\n    BN_free(b);\n    BN_free(c);\n    return 1;\n}', 'int BN_set_bit(BIGNUM *a, int n)\n{\n    int i, j, k;\n    if (n < 0)\n        return 0;\n    i = n / BN_BITS2;\n    j = n % BN_BITS2;\n    if (a->top <= i) {\n        if (bn_wexpand(a, i + 1) == NULL)\n            return (0);\n        for (k = a->top; k < i + 1; k++)\n            a->d[k] = 0;\n        a->top = i + 1;\n    }\n    a->d[i] |= (((BN_ULONG)1) << j);\n    bn_check_top(a);\n    return (1);\n}']