Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Postfix/src/util/   (Postfix Mailserver Version 3.11©)  Datei vom 8.4.2014 mit Größe 1 kB image not shown  

Quelle  mask_addr.c

  Sprache: C
 

/*++
/* NAME
/* mask_addr 3
/* SUMMARY
/* address bit banging
/* SYNOPSIS
/* #include <mask_addr.h>
/*
/* void mask_addr(addr_bytes, addr_byte_count, network_bits)
/* unsigned char *addr_bytes;
/* unsigned addr_byte_count;
/* unsigned network_bits;
/* DESCRIPTION
/* mask_addr() clears all the host bits in the specified
/* address.  The code can handle addresses of any length,
/* and bytes of any width.
/*
/* Arguments:
/* .IP addr_bytes
/* The network address in network byte order.
/* .IP addr_byte_count
/* The network address length in bytes.
/* .IP network_bits
/* The number of initial bits that will not be cleared.
/* DIAGNOSTICS
/* Fatal errors: the number of network bits exceeds the address size.
/* LICENSE
/* .ad
/* .fi
/* The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/* Wietse Venema
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
/*--*/


/* System library. */

#include <sys_defs.h>
#include <limits.h>   /* CHAR_BIT */

/* Utility library. */

#include <msg.h>
#include <mask_addr.h>

/* mask_addr - mask off a variable-length address */

void    mask_addr(unsigned char *addr_bytes,
            unsigned addr_byte_count,
            unsigned network_bits)
{
    unsigned char *p;

    if (network_bits > addr_byte_count * CHAR_BIT)
 msg_panic("mask_addr: address byte count %d too small for bit count %d",
    addr_byte_count, network_bits);

    p = addr_bytes + network_bits / CHAR_BIT;
    network_bits %= CHAR_BIT;

    if (network_bits != 0)
 *p++ &= ~0U << (CHAR_BIT - network_bits);

    while (p < addr_bytes + addr_byte_count)
 *p++ = 0;
}

Messung V0.5 in Prozent
C=70 H=96 G=83

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-08-09) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.