A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nativelibs4java/nativelibs4java/issues/496 below:

[Jnaerator, bridj] Problem with bit fields in C struct. · Issue #496 · nativelibs4java/nativelibs4java · GitHub

Hello,

I have another problem with jnaerator and bridj. There is a snippet of one structure in the header file:

typedef struct perf_event_attr {
        ...
    uint64_t    disabled       :  1,
            inherit        :  1,
            pinned         :  1,
            ...
            exclude_callchain_kernel : 1,
            exclude_callchain_user   : 1,
            __reserved_1   : 41;
        ...
}

Jnaerator generates the corresponding binding for bridj in a java class:

@Field(6) 
@Bits(1) 
public long disabled() {
    return this.io.getLongField(this, 6);
}
@Field(6) 
@Bits(1) 
public perf_event_attr disabled(long disabled) {
    this.io.setLongField(this, 6, disabled);
    return this;
}
@Field(7) 
@Bits(1) 
public long inherit() {
    return this.io.getLongField(this, 7);
}
@Field(7) 
@Bits(1) 
public perf_event_attr inherit(long inherit) {
    this.io.setLongField(this, 7, inherit);
    return this;
}
...

The problem appeared when I want to set one of the field. Indeed, if I call one of the setter with a long, it erases also the others and so, I don't have the expected values.

Thanks for your help.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4