X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fbitfield.h;h=40c1161489d66d6d56cba1fe1ba1803973289b18;hb=fd3c708f8ac4cc5782d3b0720c7fd739ba969ff6;hp=84a9679003e32de0d8fc29b3591fab230fb07bba;hpb=5f61bf21dc5f77331152291353583355c630cecc;p=babeltrace.git diff --git a/include/babeltrace/bitfield.h b/include/babeltrace/bitfield.h index 84a96790..40c11614 100644 --- a/include/babeltrace/bitfield.h +++ b/include/babeltrace/bitfield.h @@ -17,12 +17,20 @@ * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ #include /* C99 5.2.4.2 Numerical limits */ #include /* C99 5.2.4.2 Numerical limits */ -#include /* Non-standard BIG_ENDIAN, LITTLE_ENDIAN, BYTE_ORDER */ #include +#include /* Non-standard BIG_ENDIAN, LITTLE_ENDIAN, BYTE_ORDER */ /* We can't shift a int from 32 bit, >> 32 and << 32 on int is undefined */ #define _bt_piecewise_rshift(_v, _shift) \ @@ -79,7 +87,7 @@ #define _bt_bitfield_write_le(_ptr, type, _start, _length, _v) \ do { \ typeof(_v) __v = (_v); \ - typeof(*(_ptr)) *__ptr = (_ptr); \ + type *__ptr = (void *) (_ptr); \ unsigned long __start = (_start), __length = (_length); \ type mask, cmask; \ unsigned long ts = sizeof(type) * CHAR_BIT; /* type size */ \ @@ -138,7 +146,7 @@ do { \ #define _bt_bitfield_write_be(_ptr, type, _start, _length, _v) \ do { \ typeof(_v) __v = (_v); \ - typeof(*(_ptr)) *__ptr = (_ptr); \ + type *__ptr = (void *) (_ptr); \ unsigned long __start = (_start), __length = (_length); \ type mask, cmask; \ unsigned long ts = sizeof(type) * CHAR_BIT; /* type size */ \ @@ -231,8 +239,8 @@ do { \ #define _bt_bitfield_read_le(_ptr, type, _start, _length, _vptr) \ do { \ typeof(*(_vptr)) *__vptr = (_vptr); \ - typeof(*(_ptr)) *__ptr = (_ptr); \ typeof(*__vptr) __v; \ + type *__ptr = (void *) (_ptr); \ unsigned long __start = (_start), __length = (_length); \ type mask, cmask; \ unsigned long ts = sizeof(type) * CHAR_BIT; /* type size */ \ @@ -298,8 +306,8 @@ do { \ #define _bt_bitfield_read_be(_ptr, type, _start, _length, _vptr) \ do { \ typeof(*(_vptr)) *__vptr = (_vptr); \ - typeof(*(_ptr)) *__ptr = (_ptr); \ typeof(*__vptr) __v; \ + type *__ptr = (void *) (_ptr); \ unsigned long __start = (_start), __length = (_length); \ type mask, cmask; \ unsigned long ts = sizeof(type) * CHAR_BIT; /* type size */ \