Browse Source

Add EX_FLD_BE()

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
e9df4f691e
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      src/drivers/net/mlx_ipoib/bit_ops.h

+ 10
- 0
src/drivers/net/mlx_ipoib/bit_ops.h View File

@@ -80,6 +80,14 @@ struct addr_64_st {
80 80
  */
81 81
 #define MT_EXTRACT_ARRAY32(A,O,S) MT_EXTRACT32(((__u32*)A)[O >> 5],(O & MASK32(5)),S)
82 82
 
83
+/*
84
+ * MT_EXTRACT_ARRAY32_BE macro is similar to EXTRACT but works on an array of (__u32),
85
+ * thus offset may be larger than 32 (but not size).
86
+ *
87
+ * (added by mcb30)
88
+ */
89
+#define MT_EXTRACT_ARRAY32_BE(A,O,S) MT_EXTRACT32(be32_to_cpu(((__u32*)A)[O >> 5]),(O & MASK32(5)),S)
90
+
83 91
 /*
84 92
  * MT_INSERT_ARRAY32 macro is similar to INSERT but works on an array of (__u32),
85 93
  * thus offset may be larger than 32 (but not size).
@@ -90,6 +98,8 @@ struct addr_64_st {
90 98
 
91 99
 #define EX_FLD(a, st, fld) MT_EXTRACT_ARRAY32(a, MT_BIT_OFFSET(st, fld), MT_BIT_SIZE(st, fld))
92 100
 
101
+#define EX_FLD_BE(a, st, fld) MT_EXTRACT_ARRAY32_BE(a, MT_BIT_OFFSET(st, fld), MT_BIT_SIZE(st, fld))
102
+
93 103
 /* return the address of the dword holding the field 
94 104
 
95 105
 	buf = pointer to buffer where to place the value

Loading…
Cancel
Save