cell_load_direct(): simplify conditionals

pull/841/head
nick black 4 years ago
parent 0006c4c914
commit 86e6b2d89b
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1312,21 +1312,19 @@ int ncplane_putc_yx(ncplane* n, int y, int x, const cell* c){
static inline int
cell_load_direct(ncplane* n, cell* c, const char* gcluster, int bytes, int cols){
if(bytes >= 0 && cols >= 0 && bytes <= 1){
if(bytes < 0 || cols < 0){
return -1;
}
if(bytes <= 1){
cell_release(n, c);
c->channels &= ~CELL_WIDEASIAN_MASK;
c->gcluster = *gcluster;
return !!c->gcluster;
}
if(bytes < 0){
return -1;
return bytes;
}
if(cols > 1){
c->channels |= CELL_WIDEASIAN_MASK;
}else if(cols >= 0){
c->channels &= ~CELL_WIDEASIAN_MASK;
}else{
return -1;
c->channels &= ~CELL_WIDEASIAN_MASK;
}
if(!cell_simple_p(c)){
if(strcmp(gcluster, cell_extended_gcluster(n, c)) == 0){

Loading…
Cancel
Save