[openib-general] [PATCH] Fix ib_pack/unpack for 64 bits
Hal Rosenstock
halr at voltaire.com
Thu Jun 23 08:15:39 PDT 2005
Fix ib_pack/unpack for 64 bits
Signed-off-by: Hal Rosenstock <halr at voltaire.com>
Index: packer.c
===================================================================
-- packer.c (revision 2681)
+++ packer.c (working copy)
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2004 Topspin Corporation. All rights reserved.
+ * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
@@ -96,7 +97,10 @@
else
val = 0;
- mask = cpu_to_be64(((1ull << desc[i].size_bits) - 1) << shift);
+ if (desc[i].size_bits < 64)
+ mask = cpu_to_be64(((1ull << desc[i].size_bits) - 1) << shift);
+ else
+ mask = cpu_to_be64(0xffffffffffffffff << shift);
addr = (__be64 *) ((__be32 *) buf + desc[i].offset_words);
*addr = (*addr & ~mask) | (cpu_to_be64(val) & mask);
} else {
@@ -176,7 +180,10 @@
__be64 *addr;
shift = 64 - desc[i].offset_bits - desc[i].size_bits;
- mask = ((1ull << desc[i].size_bits) - 1) << shift;
+ if (desc[i].size_bits < 64)
+ mask = ((1ull << desc[i].size_bits) - 1) << shift;
+ else
+ mask = cpu_to_be64(0xffffffffffffffff << shift);
addr = (__be64 *) buf + desc[i].offset_words;
val = (be64_to_cpup(addr) & mask) >> shift;
value_write(desc[i].struct_offset_bytes,
More information about the general
mailing list