Skip to content

Commit

Permalink
backport nonref_flags elision
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchang committed Jul 4, 2024
1 parent adfee42 commit 2bbee44
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions 2.0/plink2_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6388,6 +6388,16 @@ PglErr MakePgenRobust(const uintptr_t* sample_include, const uint32_t* new_sampl
nonref_flags_write = nullptr;
nonref_flags_storage = 1;
}
} else {
if (nonref_flags_write[0] & 1) {
if (AllBitsAreOne(nonref_flags_write, raw_variant_ct)) {
nonref_flags_write = nullptr;
nonref_flags_storage = 2;
}
} else if (AllWordsAreZero(nonref_flags_write, BitCtToWordCt(raw_variant_ct))) {
nonref_flags_write = nullptr;
nonref_flags_storage = 1;
}
}
snprintf(outname_end, kMaxOutfnameExtBlen, ".pgen");
uintptr_t spgw_alloc_cacheline_ct;
Expand Down Expand Up @@ -7517,6 +7527,16 @@ PglErr MakePlink2NoVsort(const uintptr_t* sample_include, const PedigreeIdInfo*
nonref_flags_write = nullptr;
nonref_flags_storage = 1;
}
} else {
if (nonref_flags_write[0] & 1) {
if (AllBitsAreOne(nonref_flags_write, raw_variant_ct)) {
nonref_flags_write = nullptr;
nonref_flags_storage = 2;
}
} else if (AllWordsAreZero(nonref_flags_write, BitCtToWordCt(raw_variant_ct))) {
nonref_flags_write = nullptr;
nonref_flags_storage = 1;
}
}
ctx.pwcs = &(mpgwp->pwcs[0]);
ctx.thread_write_genovecs = nullptr;
Expand Down

0 comments on commit 2bbee44

Please sign in to comment.