Skip to content

Commit c6a2450

Browse files
committed
to_cigar_int(): use unsigned char argument
* `char` should always be converted to `unsigned char` before converting to larger sizes: https://wiki.sei.cmu.edu/confluence/display/c/STR34-C.+Cast+characters+to+unsigned+char+before+converting+to+larger+integer+sizes
1 parent 894ac23 commit c6a2450

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ssw.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ int32_t mark_mismatch (int32_t ref_begin1,
168168
@param op_letter CIGAR operation character ('M', 'I', etc)
169169
@return 32-bit unsigned integer, representing encoded CIGAR operation and length
170170
*/
171-
static inline uint32_t to_cigar_int (uint32_t length, char op_letter) {
172-
return (length << BAM_CIGAR_SHIFT) | (encoded_ops[(int)op_letter]);
171+
static inline uint32_t to_cigar_int (uint32_t length, unsigned char op_letter) {
172+
return (length << BAM_CIGAR_SHIFT) | (encoded_ops[op_letter]);
173173
}
174174

175175
/*! @function Extract CIGAR operation character from CIGAR 32-bit unsigned integer

0 commit comments

Comments
 (0)