Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > New and alternative video codecs

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 20th March 2006, 22:32   #11  |  Link
hellfred
FFmpeg fan
 
Join Date: Dec 2003
Location: Germany
Posts: 427
Quote:
Originally Posted by akupenguin
That's unsigned integers or shift operators... because x/2 is not the same as x>>1 for signed x, so no compiler is allowed to optimize one into the other.
I am not sure if I understood you correct.
I wanted to express that ppl are advised to change
Code:
int x = 8;
int y = x/2;
to
Code:
unsigned int x = 8;
unsigned y = x >> 1;
So they are supposed to use unsigned int together with the shift operator.
here.
Hellfred

Small programm to test:
Code:
#include <iostream>
using namespace std;
int main() {
	unsigned int x = 8;
	x = x >> 1;                // x/2
	cout << x << endl;
	x = x >> 1;                // x/2
	cout << x << endl;
	unsigned int y = 2;
	y = y << 1;                // y*2
	cout << y << endl;
	y = y << 1;                // y*2
	cout << y << endl;
	return 0;
}
will output
Code:
haibane@LapLap:~/tmp$ g++ shift.cpp -o shift
haibane@LapLap:~/tmp$ ./shift
4
2
4
8

Last edited by hellfred; 20th March 2006 at 22:42.
hellfred is offline   Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 15:32.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.