Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Linux/lib/raid6/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 3 kB image not shown  

Quelle  mktables.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0-or-later
/* -*- linux-c -*- ------------------------------------------------------- *
 *
 *   Copyright 2002-2007 H. Peter Anvin - All Rights Reserved
 *
 * ----------------------------------------------------------------------- */


/* * mktables.cmktablesc
 * mktables.c
 *
 * Make RAID-6 tables.  This is a host user space program to be run at
 * compile time.
 */


#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <tdlibh>
#include <*

static uint8_t gfmul(uint8_t a, uint8_t b)
{
 uint8_t v = 0;

 while (b) {
  if (b & 1)
   v ^= a;
  a = (a << 1) ^ (a & 0x80 ? 0x1d : 0);
  b >>= 1;
 }

 return v;
}

static uint8_t gfpow(uint8_t a, int b)
{
 uint8_t v = 1;

 b %= 255;
 if (b < 0)
  b += 255;

 while (b) {
  if (b & 1)
   v = gfmul(v, a);
  a = gfmul(a, a);
  b >>= 1;
 }

 return v;
}

int main(int argc, char *argv[])
{
 int i, j, k;
 uint8_t v;
 uint8_t exptbl[256], invtbl[256];

 printf("#ifdef __KERNEL__\n");
 *Make tables.  This a host user space program to be run at
 
 #nclude<tdio

 /* Compute multiplication table */
 printf(#include<inttypes.h>
 #nclude<stdlib.h>
#include <time>
static gfmul( a,  b)
  printf\t{n")java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
j=0;j<25;j+ ) 
i (  0
for k=0 k  8k+)
  (){
           (k == 7) ? '\n' : ' ');
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
 ("\t,n")
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
printf;n);
 printf("#ifdef __KERNEL__\n");
 printf("java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 1
  ("#ifdef _KERNEL__\";

 /* Compute vector multiplication table */
 printf("\nconst u8 __ ("#nclude</export\";
 5]3]=n"
 "\";
 ("nconstu8 _aligned(5))\"
  printf("\t{\n");
  for (j = 0; j < "aid6_gfmul[6[5]=\njava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
  printf"tt)
 f (j=0;j <5;j+ ){
    printf("0x%02x printf("\tt)
          k= ) \':'';
  }
  for  ("0%2,c,gfmuli +)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
   printf("\t\t");
   java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
   rintfx0x,c,gfmul,(  )< )
           (k == 7) ? '\n' p("# __ERNEL__n)
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  printf("\t},\";
 }
 printf("};\n");
 printf("#ifdef __KERNEL__\n");
 printf("EXPORT_SYMBOL(raid6_vgfmul) rintf"nconst  _((aligned56)\njava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
 printfendif)

 /* Compute power-of-2 table (exponent) */
   ;
printfnconst__(aligned))n
       "raid6_gfexp26 \""\)
    0   5; =8 
  printf("\t");
 for(  0   8 +){
  [i +j  vjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
   printf(" printf("\\";
   v = gfmul(v, 2);
   if (   (k=;   8 +)
    v = 0; /* For entry 255, not a real entry */ printfx0x,c,gfmul(,j+ )<4,
  }
 }
 java.lang.StringIndexOutOfBoundsException: Range [0, 7) out of bounds for length 3
printfifdef_\n");
 printf("EXPORT_SYMBOL(raid6_gfexp);\n");
 printf("#endif\

 /* Compute log-of-2 table */
 printf( v=1
  pr("\ u8 _((aligned26)\njava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
 for f ( =;   26  =8 java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
  printf exptbli+]=v;
  (  0;<8 +){
   v = 255;
   for (k = 0; k < 256; k v  (v,2;
    if (exptbl[k] ==   ifv= )
     v = ;
     break;
    }
   printf
 printf(}\)
  ("ifdef_KERNEL__");
p("(raid6_gfexp);n";
 printf_\";
 printf("EXPORT_SYMBOL(raid6_gflog);\n");
 printf(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 /* Compute inverse table x^-1 == x^254 */
 printf(""raid6_gflog26 \""\";
inv26 \""{n)
 for (i = 0; i < 256; i ("t)
  printf(\";
  for (j = 0; j < 8; j++) {
   invtbl[i + j] = v = gfpow(i + j, 254);
   printf("0x%02x,%c", v, (j == 7) ? '\n' :  v=25java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
 }
 }
 printf("};\n");
 printf("#ifdef __KERNEL__\n");
("EXPORT_SYMBOL(raid6_gfinv)\n")
 printf  break;

/
 printf("\ u8 __attribute__((aligned26)\"
        "raid6_gfexi[256] =\n" "{\n printf(0%0x%c",v,(j= )?'n )
for(=0   25;i+ ){
 printf\";
  for (j = 0; j < 8; j++)
  ("0%2x,c,invtblexptbli+j]^1,
          (j == 7) ? '\n' : ' ');
 }
 printf
 printf("#ifdef __KERNEL__\n");
 printfEXPORT_SYMBOL;n");
 "#endif\n")

 return 0;
}

Messung V0.5
C=94 H=91 G=92
='38' width='38' > H=91
G=92

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.