Fossil SCM

Use bitwise operators consistently, even if in this case it does not make a difference.

danield 2026-06-17 15:47 UTC trunk
Commit 524474cfa0c05a07d62f75d46014beb3eab79e9896725696df0c06774c156002
1 file changed +2 -2
+2 -2
--- src/util.c
+++ src/util.c
@@ -917,12 +917,12 @@
917917
unsigned char zStr[37];
918918
unsigned char *p = zStr;
919919
int i, k;
920920
921921
sqlite3_randomness(16, aBlob);
922
- aBlob[6] = (aBlob[6]&0x0f) + 0x40; /* Version byte: 0100 xxxx */
923
- aBlob[8] = (aBlob[8]&0x3f) + 0x80; /* Variant byte: 10xx xxxx */
922
+ aBlob[6] = (aBlob[6]&0x0f) | 0x40; /* Version byte: 0100 xxxx */
923
+ aBlob[8] = (aBlob[8]&0x3f) | 0x80; /* Variant byte: 10xx xxxx */
924924
925925
for(i=0, k=0x550; i<16; i++, k=k>>1){
926926
if( k&1 ){
927927
*p++ = '-'; /* Add a dash after byte 4, 6, 8, and 12 */
928928
}
929929
--- src/util.c
+++ src/util.c
@@ -917,12 +917,12 @@
917 unsigned char zStr[37];
918 unsigned char *p = zStr;
919 int i, k;
920
921 sqlite3_randomness(16, aBlob);
922 aBlob[6] = (aBlob[6]&0x0f) + 0x40; /* Version byte: 0100 xxxx */
923 aBlob[8] = (aBlob[8]&0x3f) + 0x80; /* Variant byte: 10xx xxxx */
924
925 for(i=0, k=0x550; i<16; i++, k=k>>1){
926 if( k&1 ){
927 *p++ = '-'; /* Add a dash after byte 4, 6, 8, and 12 */
928 }
929
--- src/util.c
+++ src/util.c
@@ -917,12 +917,12 @@
917 unsigned char zStr[37];
918 unsigned char *p = zStr;
919 int i, k;
920
921 sqlite3_randomness(16, aBlob);
922 aBlob[6] = (aBlob[6]&0x0f) | 0x40; /* Version byte: 0100 xxxx */
923 aBlob[8] = (aBlob[8]&0x3f) | 0x80; /* Variant byte: 10xx xxxx */
924
925 for(i=0, k=0x550; i<16; i++, k=k>>1){
926 if( k&1 ){
927 *p++ = '-'; /* Add a dash after byte 4, 6, 8, and 12 */
928 }
929

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button