Current Path : /usr/opt/openssl11/share/doc/openssl/html/man3/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/opt/openssl11/share/doc/openssl/html/man3/BN_mask_bits.html |
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>BN_set_bit</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rev="made" href="mailto:root@hsxx.drive.ne.jp" /> </head> <body style="background-color: white"> <!-- INDEX BEGIN --> <div name="index"> <p><a name="__index__"></a></p> <ul> <li><a href="#name">NAME</a></li> <li><a href="#synopsis">SYNOPSIS</a></li> <li><a href="#description">DESCRIPTION</a></li> <li><a href="#return_values">RETURN VALUES</a></li> <li><a href="#see_also">SEE ALSO</a></li> <li><a href="#copyright">COPYRIGHT</a></li> </ul> <hr name="index" /> </div> <!-- INDEX END --> <p> </p> <hr /> <h1><a name="name">NAME</a></h1> <p>BN_set_bit, BN_clear_bit, BN_is_bit_set, BN_mask_bits, BN_lshift, BN_lshift1, BN_rshift, BN_rshift1 - bit operations on BIGNUMs</p> <p> </p> <hr /> <h1><a name="synopsis">SYNOPSIS</a></h1> <pre> #include <openssl/bn.h></pre> <pre> int BN_set_bit(BIGNUM *a, int n); int BN_clear_bit(BIGNUM *a, int n);</pre> <pre> int BN_is_bit_set(const BIGNUM *a, int n);</pre> <pre> int BN_mask_bits(BIGNUM *a, int n);</pre> <pre> int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); int BN_lshift1(BIGNUM *r, BIGNUM *a);</pre> <pre> int BN_rshift(BIGNUM *r, BIGNUM *a, int n); int BN_rshift1(BIGNUM *r, BIGNUM *a);</pre> <p> </p> <hr /> <h1><a name="description">DESCRIPTION</a></h1> <p><code>BN_set_bit()</code> sets bit <strong>n</strong> in <strong>a</strong> to 1 (<code>a|=(1<<n)</code>). The number is expanded if necessary.</p> <p><code>BN_clear_bit()</code> sets bit <strong>n</strong> in <strong>a</strong> to 0 (<code>a&=~(1<<n)</code>). An error occurs if <strong>a</strong> is shorter than <strong>n</strong> bits.</p> <p><code>BN_is_bit_set()</code> tests if bit <strong>n</strong> in <strong>a</strong> is set.</p> <p><code>BN_mask_bits()</code> truncates <strong>a</strong> to an <strong>n</strong> bit number (<code>a&=~((~0)<<n)</code>). An error occurs if <strong>a</strong> already is shorter than <strong>n</strong> bits.</p> <p><code>BN_lshift()</code> shifts <strong>a</strong> left by <strong>n</strong> bits and places the result in <strong>r</strong> (<code>r=a*2^n</code>). Note that <strong>n</strong> must be nonnegative. BN_lshift1() shifts <strong>a</strong> left by one and places the result in <strong>r</strong> (<code>r=2*a</code>).</p> <p><code>BN_rshift()</code> shifts <strong>a</strong> right by <strong>n</strong> bits and places the result in <strong>r</strong> (<code>r=a/2^n</code>). Note that <strong>n</strong> must be nonnegative. BN_rshift1() shifts <strong>a</strong> right by one and places the result in <strong>r</strong> (<code>r=a/2</code>).</p> <p>For the shift functions, <strong>r</strong> and <strong>a</strong> may be the same variable.</p> <p> </p> <hr /> <h1><a name="return_values">RETURN VALUES</a></h1> <p><code>BN_is_bit_set()</code> returns 1 if the bit is set, 0 otherwise.</p> <p>All other functions return 1 for success, 0 on error. The error codes can be obtained by <em>ERR_get_error(3)</em>.</p> <p> </p> <hr /> <h1><a name="see_also">SEE ALSO</a></h1> <p><em>BN_num_bytes(3)</em>, <em>BN_add(3)</em></p> <p> </p> <hr /> <h1><a name="copyright">COPYRIGHT</a></h1> <p>Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.</p> <p>Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p> </body> </html>