@Retention(value=RUNTIME) @Target(value=METHOD) public @interface CBitfield
C struct
.
If the method has a non-void return type, it is a get-method of the field. Calls of the method
are replaced with a memory read. The possible signatures are
FieldType getFieldName([LocationIdentity locationIdentity]);
If the method has the return type void, it is a set-method of the field. Calls of the method are
replaced with memory accesses. The possible signatures are
void setFieldName(FieldType value, [LocationIdentity locationIdentity]);
Most
architectures do not provide write instructions on the bit-level. Therefore, the memory write of
the new value is preceded by a memory read of the old value. This makes bitfield writes
non-atomic.
The receiver is the pointer to the struct that is accessed, i.e., the base address of the memory access.
The FieldType
must be must be a primitive integer type or a word type
.
The optional parameter locationIdentity
specifies the LocationIdentity
to be used
for the memory access. Two memory accesses with two different location identities are guaranteed
to not alias. Note that UniqueLocationIdentity
annotation, cannot be used on bitfields.
Multiple accessor methods, with different signatures according to the rules of allowed signatures, are allowed for a single field.