fix nullptr check
This commit is contained in:
parent
832275cb75
commit
31a7e22aa6
@ -33,6 +33,8 @@ template <typename T> struct RelPtr
|
||||
|
||||
const T *get() const { return reinterpret_cast<const T *>(reinterpret_cast<const char *>(this) + offset); }
|
||||
|
||||
bool is_null() const { return offset == 0; }
|
||||
|
||||
const T &operator[](std::size_t index) const { return get()[index]; }
|
||||
|
||||
const T &operator*() const { return *(get()); }
|
||||
|
@ -241,7 +241,7 @@ struct GowinCstReader
|
||||
};
|
||||
|
||||
|
||||
void add_sip_constraints(Context *ctx, const Extra_package_data_POD *extra) {
|
||||
static void add_sip_constraints(Context *ctx, const Extra_package_data_POD *extra) {
|
||||
for(auto cst : extra->cst) {
|
||||
auto it = ctx->cells.find(IdString(cst.net));
|
||||
if (it == ctx->cells.end()) {
|
||||
@ -260,8 +260,8 @@ void add_sip_constraints(Context *ctx, const Extra_package_data_POD *extra) {
|
||||
bool gowin_apply_constraints(Context *ctx, std::istream &in)
|
||||
{
|
||||
// implicit constraints from SiP pins
|
||||
if(!ctx->package_info->extra_data.is_null()) {
|
||||
const Extra_package_data_POD *extra = reinterpret_cast<const Extra_package_data_POD *>(ctx->package_info->extra_data.get());
|
||||
if(extra != nullptr) {
|
||||
add_sip_constraints(ctx, extra);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user