All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haavard Skinnemoen <hskinnemoen@atmel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] cramfs voodoo
Date: Sat, 24 Nov 2007 22:20:14 +0100	[thread overview]
Message-ID: <20071124222014.1fe26fcd@siona> (raw)

Does anyone know why the following deep voodoo magic in
include/cramfs/cramfs_fs.h is needed?

#define CRAMFS_GET_NAMELEN(x)	(((u8*)(x))[8] & 0x3f)
#define CRAMFS_GET_OFFSET(x)	((CRAMFS_24(((u32*)(x))[2] & 0xffffff) << 2) |\
				 ((((u32*)(x))[2] & 0xc0000000) >> 30))
#define CRAMFS_SET_NAMELEN(x,y)	(((u8*)(x))[8] = (((0x3f & (y))) | \
						  (0xc0 & ((u8*)(x))[8])))
#define CRAMFS_SET_OFFSET(x,y)	(((u32*)(x))[2] = (((y) & 3) << 30) | \
				 CRAMFS_24((((y) & 0x03ffffff) >> 2)) | \
				 (((u32)(((u8*)(x))[8] & 0x3f)) << 24))

It looks like a workaround for buggy bitfield handling in the compiler,
but newer versions of gcc are not@all happy with it and spews
warnings like this:

cramfs.c:82: warning: dereferencing type-punned pointer will break
strict-aliasing rules

which indicates that the generated code is probably wrong.

Can we get rid of it somehow?

Haavard

             reply	other threads:[~2007-11-24 21:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-24 21:20 Haavard Skinnemoen [this message]
2007-11-24 22:40 ` [U-Boot-Users] [PATCH] Make CRAMFS optional (was Re: cramfs voodoo) Haavard Skinnemoen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071124222014.1fe26fcd@siona \
    --to=hskinnemoen@atmel.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.