~ubuntu-branches/ubuntu/trusty/ceph/trusty

« back to all changes in this revision

Viewing changes to src/erasure-code/jerasure/gf-complete/include/gf_general.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-04-09 11:14:03 UTC
  • mfrom: (49.1.6 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20140409111403-ejsqcnimtg4or7rl
Tags: 0.79-0ubuntu1
* New upstream release (LP: #1278466):
  - d/p/modules.patch: Refreshed.
  - d/ceph.install: Install all jerasure modules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
 
3
 * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
 
4
 * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
 
5
 *
 
6
 * gf_general.h
 
7
 *
 
8
 * This file has helper routines for doing basic GF operations with any
 
9
 * legal value of w.  The problem is that w <= 32, w=64 and w=128 all have
 
10
 * different data types, which is a pain.  The procedures in this file try
 
11
 * to alleviate that pain.  They are used in gf_unit and gf_time.
 
12
 */
 
13
 
 
14
#pragma once
 
15
 
 
16
#include <stdio.h>
 
17
#include <getopt.h>
 
18
#include <stdint.h>
 
19
#include <string.h>
 
20
#include <stdlib.h>
 
21
#include <time.h>
 
22
 
 
23
#include "gf_complete.h"
 
24
 
 
25
typedef union {
 
26
  uint32_t w32;
 
27
  uint64_t w64;
 
28
  uint64_t w128[2];
 
29
} gf_general_t;
 
30
 
 
31
void gf_general_set_zero(gf_general_t *v, int w);
 
32
void gf_general_set_one(gf_general_t *v, int w);
 
33
void gf_general_set_two(gf_general_t *v, int w);
 
34
 
 
35
int gf_general_is_zero(gf_general_t *v, int w);
 
36
int gf_general_is_one(gf_general_t *v, int w);
 
37
int gf_general_are_equal(gf_general_t *v1, gf_general_t *v2, int w);
 
38
 
 
39
void gf_general_val_to_s(gf_general_t *v, int w, char *s, int hex);
 
40
int  gf_general_s_to_val(gf_general_t *v, int w, char *s, int hex);
 
41
 
 
42
void gf_general_set_random(gf_general_t *v, int w, int zero_ok);
 
43
 
 
44
void gf_general_add(gf_t *gf, gf_general_t *a, gf_general_t *b, gf_general_t *c);
 
45
void gf_general_multiply(gf_t *gf, gf_general_t *a, gf_general_t *b, gf_general_t *c);
 
46
void gf_general_divide(gf_t *gf, gf_general_t *a, gf_general_t *b, gf_general_t *c);
 
47
void gf_general_inverse(gf_t *gf, gf_general_t *a, gf_general_t *b);
 
48
 
 
49
void gf_general_do_region_multiply(gf_t *gf, gf_general_t *a, 
 
50
                                   void *ra, void *rb, 
 
51
                                   int bytes, int xor);
 
52
 
 
53
void gf_general_do_region_check(gf_t *gf, gf_general_t *a, 
 
54
                                void *orig_a, void *orig_target, void *final_target, 
 
55
                                int bytes, int xor);
 
56
 
 
57
 
 
58
/* Which is M, D or I for multiply, divide or inverse. */
 
59
 
 
60
void gf_general_set_up_single_timing_test(int w, void *ra, void *rb, int size);
 
61
int  gf_general_do_single_timing_test(gf_t *gf, void *ra, void *rb, int size, char which);