Cast to uint16 in pg_checksum_page() - Mailing list pgsql-hackers

From David Steele
Subject Cast to uint16 in pg_checksum_page()
Date
Msg-id 91d86c8a-11fc-7b88-43eb-5ca3f6fb8bd3@pgmasters.net
Whole thread Raw
Responses Re: Cast to uint16 in pg_checksum_page()
List pgsql-hackers
Hackers,

The current code in checksum_impl.h does not play nice with -Wconversion 
on gcc:

warning: conversion to 'uint16 {aka short unsigned int}' from 'uint32 
{aka unsigned int}' may alter its value [-Wconversion]
                                           return (checksum % 65535) + 1;
                                                  ~~~~~~~~~~~~~~~~~~~^~~

It seems like an explicit cast to uint16 would be better?

Regards,
-- 
-David
david@pgmasters.net

Attachment

pgsql-hackers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: Psql patch to show access methods info
Next
From: Tom Lane
Date:
Subject: Re: Is it time to retire type "opaque"?