~ubuntu-branches/ubuntu/trusty/grub2/trusty

« back to all changes in this revision

Viewing changes to grub-core/lib/crc64.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-01-16 15:18:04 UTC
  • mfrom: (17.6.38 experimental)
  • Revision ID: package-import@ubuntu.com-20140116151804-3foouk7fpqcq3sxx
Tags: 2.02~beta2-2
* Convert patch handling to git-dpm.
* Add bi-endian support to ELF parser (Tomohiro B Berry).
* Adjust restore_mkdevicemap.patch to mark get_kfreebsd_version as static,
  to appease "gcc -Werror=missing-prototypes".
* Cherry-pick from upstream:
  - Change grub-macbless' manual page section to 8.
* Install grub-glue-efi, grub-macbless, grub-render-label, and
  grub-syslinux2cfg.
* grub-shell: Pass -no-pad to xorriso when building floppy images.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
static grub_uint64_t crc64_table [256];
27
27
 
 
28
/* Helper for init_crc64_table.  */
 
29
static grub_uint64_t
 
30
reflect (grub_uint64_t ref, int len)
 
31
{
 
32
  grub_uint64_t result = 0;
 
33
  int i;
 
34
 
 
35
  for (i = 1; i <= len; i++)
 
36
    {
 
37
      if (ref & 1)
 
38
        result |= 1ULL << (len - i);
 
39
      ref >>= 1;
 
40
    }
 
41
 
 
42
  return result;
 
43
}
 
44
 
28
45
static void
29
46
init_crc64_table (void)
30
47
{
31
 
  auto grub_uint64_t reflect (grub_uint64_t ref, int len);
32
 
  grub_uint64_t reflect (grub_uint64_t ref, int len)
33
 
    {
34
 
      grub_uint64_t result = 0;
35
 
      int i;
36
 
 
37
 
      for (i = 1; i <= len; i++)
38
 
        {
39
 
          if (ref & 1)
40
 
            result |= 1ULL << (len - i);
41
 
          ref >>= 1;
42
 
        }
43
 
 
44
 
      return result;
45
 
    }
46
 
 
47
48
  grub_uint64_t polynomial = 0x42f0e1eba9ea3693ULL;
48
49
  int i, j;
49
50