Re: Question about the function,ni_stc_dma_channel_select_bitfield
On 06/05/15 01:22, nick wrote: Greetings All, I am wondering if in the function,ni_stc_dma_channel_select_bitfield the line: return 1 << channel; is guaranteed to be below the threshold that guarantees us to not overflow on a unsigned 32 integer due to bit wise shifting to the left. Thanks Nick if (channel < 4) return 1 << channel; So, yes. -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: Question about the function,ni_stc_dma_channel_select_bitfield
On 2015-05-06 05:10 AM, Ian Abbott wrote: > On 06/05/15 01:22, nick wrote: >> Greetings All, >> I am wondering if in the function,ni_stc_dma_channel_select_bitfield the >> line: >> return 1 << channel; >> is guaranteed to be below the threshold that guarantees us to not overflow on >> a unsigned 32 integer due to bit wise shifting to the left. >> Thanks Nick >> > > if (channel < 4) > return 1 << channel; > > So, yes. > This should be commented in my option as this is not common knowledge unless you known the hardware specs really well. If I should send in a patch adding a comment here please let me known. Thanks, Nick ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: Question about the function,ni_stc_dma_channel_select_bitfield
On Wednesday, May 06, 2015 7:06 AM, nick wrote: > On 2015-05-06 05:10 AM, Ian Abbott wrote: >> On 06/05/15 01:22, nick wrote: >>> Greetings All, >>> I am wondering if in the function,ni_stc_dma_channel_select_bitfield the >>> line: >>> return 1 << channel; >>> is guaranteed to be below the threshold that guarantees us to not overflow >>> on >>> a unsigned 32 integer due to bit wise shifting to the left. >>> Thanks Nick >>> >> >> if (channel < 4) >> return 1 << channel; >> >> So, yes. >> > This should be commented in my option as this is not common knowledge > unless you known the hardware specs really well. If I should send in > a patch adding a comment here please let me known. A comment is not necessary. The code explicitly states that channel (an unsigned var) needs to be < 4 for the bit shift to happen. Hartley ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: Question about the function,ni_stc_dma_channel_select_bitfield
On Wed, May 06, 2015 at 10:05:55AM -0400, nick wrote: > On 2015-05-06 05:10 AM, Ian Abbott wrote: > > On 06/05/15 01:22, nick wrote: > >> Greetings All, > >> I am wondering if in the function,ni_stc_dma_channel_select_bitfield the > >> line: > >> return 1 << channel; > >> is guaranteed to be below the threshold that guarantees us to not overflow > >> on > >> a unsigned 32 integer due to bit wise shifting to the left. > >> Thanks Nick > >> > > > > if (channel < 4) > > return 1 << channel; > > > > So, yes. > > > This should be commented in my option as this is not common knowledge > unless you known the hardware specs really well. If I should send in > a patch adding a comment here please let me known. Nick, this is one reason why you were banned from all vger.kernel.org mailing lists. You are wasting people's time and refuse to listen to others. I do give you credit for coming up with very strange questions that show a complete lack of understanding of the C language, that is intertaining at times, like this response, nice job with that. Please everyone, just add him to your killfile and ignore him, it makes life much easier these days when he tries to go around the vger ban by emailing developers directly as he did here. greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: Question about the function,ni_stc_dma_channel_select_bitfield
On 2015-05-06 03:09 PM, Greg KH wrote: > On Wed, May 06, 2015 at 10:05:55AM -0400, nick wrote: >> On 2015-05-06 05:10 AM, Ian Abbott wrote: >>> On 06/05/15 01:22, nick wrote: Greetings All, I am wondering if in the function,ni_stc_dma_channel_select_bitfield the line: return 1 << channel; is guaranteed to be below the threshold that guarantees us to not overflow on a unsigned 32 integer due to bit wise shifting to the left. Thanks Nick >>> >>> if (channel < 4) >>> return 1 << channel; >>> >>> So, yes. >>> >> This should be commented in my option as this is not common knowledge >> unless you known the hardware specs really well. If I should send in >> a patch adding a comment here please let me known. > > Nick, this is one reason why you were banned from all vger.kernel.org > mailing lists. You are wasting people's time and refuse to listen to > others. > > I do give you credit for coming up with very strange questions that show > a complete lack of understanding of the C language, that is intertaining > at times, like this response, nice job with that. > > Please everyone, just add him to your killfile and ignore him, it makes > life much easier these days when he tries to go around the vger ban by > emailing developers directly as he did here. > > greg k-h > Greg Kh, Sorry about that :(, your absolutely right I need to listen more to the community. After thinking about it your right that was a terrible question in nature and I should have assumed based off the code that my assumptions were right. Nick ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel