Skip to content
Snippets Groups Projects
Commit f9ad15e8 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix off-by-one error in date/time field bit-mask calculation

This became apparent when the the LSB of the day got set (an odd
day). Oops.

This only impacted decoding of date/time, not encoding.
parent 445394f9
No related branches found
No related tags found
No related merge requests found
Pipeline #7416 passed
...@@ -368,7 +368,7 @@ typedef struct { /* Time with time-zone */ ...@@ -368,7 +368,7 @@ typedef struct { /* Time with time-zone */
} when_t; } when_t;
// We encode Month/Day/Hour/Min/Sec into 26 bits: // We encode Month/Day/Hour/Min/Sec into 26 bits:
#define SMB_DATE_MK_MASK(width, shift) (((1 << (width + 1)) - 1) << shift) #define SMB_DATE_MK_MASK(width, shift) (((1 << (width)) - 1) << shift)
#define SMB_DATE_MON_SHIFT 22 #define SMB_DATE_MON_SHIFT 22
#define SMB_DATE_MON_MASK SMB_DATE_MK_MASK(4, SMB_DATE_MON_SHIFT) #define SMB_DATE_MON_MASK SMB_DATE_MK_MASK(4, SMB_DATE_MON_SHIFT)
#define SMB_DATE_DAY_SHIFT 17 #define SMB_DATE_DAY_SHIFT 17
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment