bit operators

Борис Коваленко b.ju.kovalenko at gmail.com
Sun Feb 19 05:52:01 CET 2017


Thank you, Ondrej! Choose int set solution

⁣С уважением, 
Борис Коваленко​

На 19 февр. 2017 г., 5:10, в 5:10, Ondrej Zajicek <santiago at crfreenet.org> написал:>On Sat, Feb 18, 2017 at 06:52:56PM +0000, Борис Коваленко wrote:
>> Hello!
>> 
>> I have an idea to write common filters like
>> 
>> define RF_REDISTRIBUTE_CONNECTED 0x10
>> define RF_REDISTRIBUTE_STATIC 0x20
>> .....
>> 
>> protocol ospf main_ospf {
>> export where f_main_ospf_e(RF_REDISTRIBUTE_CONNECTED |
>> RF_REDISTRIBUTE_STATIC);
>> .....
>> }
>> 
>> function f_main_ospf_e(int flags) {
>> if(source ~ [RTS_STATIC, RTS_STATIC_DEVICE] && (flags &
>> RF_REDISTRIBUTE_STATIC)
>> ........
>> }
>> 
>> Unfortunatelly there are not bit operators :( But may be there is
>another
>> way?
>
>Well, you could add multiple arguments to functions.
>
>Or you could add 'int set' argument to function:
>export where f_main_ospf_e([RF_REDISTRIBUTE_CONNECTED,
>RF_REDISTRIBUTE_STATIC]);
>
>Or could use specific functions for each type:
>export where f_ospf_redistribute_connected() ||
>f_ospf_redistribute_static();
>
>-- 
>Elen sila lumenn' omentielvo
>
>Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
>OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
>"To err is human -- to blame it on a computer is even more so."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20170219/1ddd2451/attachment.html>


More information about the Bird-users mailing list