a += (UInt32)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k +
3] << 24));
I'm trying to understand what the above line of code does. I understand
that the url[] part of (url[k + 1] << 8) returns part of the string but I
don't understand what the << 8 does. 6 1481
"Bishop" <in**@tgscom.co mwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>a += (UInt32)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k + 3] << 24));
I'm trying to understand what the above line of code does. I understand
that the url[] part of (url[k + 1] << 8) returns part of the string but
I don't understand what the << 8 does.
It's a binary shift. x<<8 takes the bits of x and shifts them to the left
eight places, introducing zeroes on the right. For instance, 129<<8 would
return 33024. In binary, 129 is 10000001, and 33024 is 100000010000000 0.
Alberto Poblacion skrev:
"Bishop" <in**@tgscom.co mwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>a += (UInt32)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k + 3] << 24));
I'm trying to understand what the above line of code does. I understand that the url[] part of (url[k + 1] << 8) returns part of the string but I don't understand what the << 8 does.
It's a binary shift. x<<8 takes the bits of x and shifts them to the
left eight places, introducing zeroes on the right. For instance, 129<<8
would return 33024. In binary, 129 is 10000001, and 33024 is
100000010000000 0.
In my opinion the statement above should use binary-or (|) instead of
plus (+).
a += (UInt32)(url[k + 0] | (url[k + 1] << 8) | (url[k + 2] << 16) |
(url[k + 3] << 24));
I assume that the url[] array is unsigned bytes.
>
--
Bjørn Brox
On Jul 7, 1:42*pm, "Bishop" <i...@tgscom.co mwrote:
a += (UInt32)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k +
3] << 24));
I'm trying to understand what the above line of code does. *I understand
that the url[] part of *(url[k + 1] << 8) *returns part of the stringbut I
don't understand what the << 8 does.
Hi,
What I do not understand is what he is doing, some kind of key
verification?
Ignacio Machin ( .NET/ C# MVP ) wrote:
On Jul 7, 1:42 pm, "Bishop" <i...@tgscom.co mwrote:
>a += (UInt32)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k + 3] << 24));
I'm trying to understand what the above line of code does. I understand that the url[] part of (url[k + 1] << 8) returns part of the string but I don't understand what the << 8 does.
What I do not understand is what he is doing, some kind of key
verification?
To me it looks more like a reimplementatio n of BitConverter.To Int32 !
Arne
On 7 Lug, 21:26, "Ignacio Machin ( .NET/ C# MVP )"
<ignacio.mac... @gmail.comwrote :
On Jul 7, 1:42*pm, "Bishop" <i...@tgscom.co mwrote:
a += (UInt32)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k +
3] << 24));
I'm trying to understand what the above line of code does. *I understand
that the url[] part of *(url[k + 1] << 8) *returns part of the string but I
don't understand what the << 8 does.
Hi,
What I do not understand is what he is doing, some kind of key
verification?
No, it's taking the 4 8-bit numbers of an ip and building the
corresponding 32 bit number.
M.
If you see a shift of n as a multiplication by 2^n, that is a way to write
in positional notation. As example, with base 10 instead of base 2, what is
proposed can be seen as:
firstDigit + secondDigit * 10 + thirdDigit * 100 + fourthDigit *
1000
except that here, the base is not 10, neither is it 2, but 256 (and x << 8
is like x * 256, assuming x is an integer which will not overflow when
multiplied by 256, as example).
Since the algorithm sum the result, it *may* be part of *some* check (like
someone defining his own-made CRC check), but in itself, it just 'rewrite'
four octets as one 'equivalent' 4-octets wide integer, and add the result
into a variable a.
Vanderghast, Access MVP
"Ignacio Machin ( .NET/ C# MVP )" <ig************ @gmail.comwrote in
message
news:0a******** *************** ***********@59g 2000hsb.googleg roups.com...
On Jul 7, 1:42 pm, "Bishop" <i...@tgscom.co mwrote:
a += (UInt32)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k
+
3] << 24));
I'm trying to understand what the above line of code does. I understand
that the url[] part of (url[k + 1] << 8) returns part of the string but I
don't understand what the << 8 does.
Hi,
What I do not understand is what he is doing, some kind of key
verification? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: SAN CAZIANO |
last post by:
can you help me please because I can't understand why the code doesn't seems
to function very well:
in onkeypress it must verify if insert number or string value in the fiels,
but it doesn't seems to function very well
(in frontpage it works but here it doesn't)
PROGRAMMA IN FRONTPAGE
<form method="get" name="f">
|
by: Andre Majorel |
last post by:
I'm trying to make a compact <dl> class à la troff .TP where you
have
Term Definition of the term.
Longer Term
Definition of the longer term.
i.e. if the <dt> text is shorter than the margin-left, the <dd>
is on the same line. Otherwise, the <dd> goes on the next line.
|
by: Christopher Benson-Manica |
last post by:
Sorry for the lame title, but it's hard to condense what I'm about to
say... Here's my situation (my first real C++ situation, yay!).
Currently we have a MyTCPThread (don't let the name scare you, this
isn't OT) that has a socket member object that has methods Send() and
GetLine() for sending and receiving data. I want to subclass
MyTCPThread so I can use << and >> as wrappers for Send() and
GetLine() (Send() is my primary concern at the...
|
by: Mate Visky |
last post by:
hi,
i have a little problame. i got this xml file:
----
<?xml version="1.0" encoding="UTF-8" ?>
- <out>
- <design>
- <html>
- <!]>
</html>
|
by: Steve Richter |
last post by:
is it possible to overload the << operator in c# similar to the way it
is done in c++ ?
MyTable table = new MyTable( ) ;
MyTableRow row = new MyTableRow( ) ;
row << new MyTableCell( "cell1 text contents" ) ;
row << new MyTableCell( "cell2 text contents" ) ;
table << row ;
thanks,
| |
by: Wolfgang Kaml |
last post by:
I am not sure if this is more of an expert question, but I am sure that they
are out there.
I'd like to setup a general application or bin directory on my Win2003.Net
Server that will hold some useful utils that more pages on that server can
use.
As an example, I have created a Page Counter class that opens an Access .mdb
file, counts the current entries for that page, and adds a new entry with
some information regarding the current...
|
by: Ken Varn |
last post by:
I want to add my own custom <STYLE> section in the <HEAD> section of my
ASP.NET page within a custom control. Can someone tell me how I can have my
custom control add tags to the <HEAD> section of the page dynamically when
the page is rendered?
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
|
by: arnuld |
last post by:
WANTED:
/* C++ Primer - 4/e
*
* Exercise: 9.26
* STATEMENT
* Using the following definition of ia, copy ia into a vector and
into a list. Use the single iterator form of erase to remove the
elements with odd values from your list * and the even values from your
vector.
|
by: =?Utf-8?B?Y2xhcmE=?= |
last post by:
Hi all,
how to understand the following declaration in MSDN about nullable structure
<SerializableAttribute_
Public Structure Nullable(Of T As Structure)
I can : dim id as nullable(of integer), but integer is not a structure, so
what is the function of the AS Structure here?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |