I give up, how do I make this not fail under 2.4?
fcntl.ioctl(sel f.dev.fileno(), 0xc0047a80,stru ct.pack("HBB",0 x1c,0x00,0x00))
I get an OverflowError: long int too large to convert to int
ioctl() is expecting a 32-bit integer value, and 0xc0047a80 has
the high-order bit set. I'm assuming Python thinks it's a
signed value. How do I tell Python that 0xc0047a80 is an
unsigned 32-bit value?
--
Grant Edwards grante Yow! I demand IMPUNITY!
at
visi.com
Sep 15 '05
11 6301
On 2005-09-16, Terry Reedy <tj*****@udel.e du> wrote: One of the nasty bits in a pure-python approach is that there's no way to write a literal with a fixed length. For example, instead of writing 0xf7 to get an 8-bit value and 0x12345789 to get a 32-bit value, you have to instantiate a class like Word8(0xf7) and Word32(0x123456 78).
That starts to make things pretty hard to read.
This is no worse than having to write decimal(.534893 84) or whatever to get a decimal float rather than a binary float, or indeed, than writing cname(init_data ) to get an instance of all types/classes. There are many more possible classes than sensible literal formats. A few basic and general types have been blessed with literals that translate into inplicit type constructor calls. Indeed, some literals seem necessary to start the object construction process. However, most types and classes, including your particular special-use classes, do not have corresponding literals and never will in the general release.
Oh, I realize that. I was just fantasizing about features that
would make it easier to write the narrow set of applications
that I tend to write. I didn't mean that I thought the need
was widespread enough to seriously consider adding it to the
language.
--
Grant Edwards grante Yow! I'd like MY data-base
at JULIENNED and stir-fried!
visi.com
Grant Edwards wrote: I give up, how do I make this not fail under 2.4?
fcntl.ioctl(sel f.dev.fileno(), 0xc0047a80,stru ct.pack("HBB",0 x1c,0x00,0x00))
I get an OverflowError: long int too large to convert to int
ioctl() is expecting a 32-bit integer value, and 0xc0047a80 has the high-order bit set. I'm assuming Python thinks it's a signed value. How do I tell Python that 0xc0047a80 is an unsigned 32-bit value?
This is fixed in the 2.5 CVS branch, where the ioctl() Python C wrapper
expects an unsigned integer instead of a signed one.
Reinhold This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Thomas Baier |
last post by:
Hi there,
I've got a little problem. My aim is to send a hex file to a
microcontroller. So I'm reading the hex-File into a buffer and then have to
convert it to send the hex numbers. So now I want to know how I can get a
long out of something like
char* buf = "0xFF";
I tried
long number = atoi((const char*) buf);
|
by: Mike |
last post by:
My users have to select an value from a fixed selection of values. The
obvious choice of control for such a requirement is to use a <select> (i.e.
a combo box).
My problem is that sometimes, these combo boxes will have a *large* number
of values. There could be any number of values in them from 5 to 5 million
(unlikely it would be this large but possible).
Obviously 5 million is far too much to populate a <select> control with.
Does...
|
by: Vicki Carlsen |
last post by:
Hi,
What is the easiest way to convert a DateTime object to a
long?? - And the other way back??
(For database use)
Regards,
Vicki
|
by: Mike P |
last post by:
I am trying to test if a number is between and certain range. Is there
a clever C# way to do it that is better than this?
if (((Convert.ToInt64(strRequestSpecific)) >=
(Convert.ToInt64(strStartRangeLessZero))) &&
((Convert.ToInt64(strRequestSpecific)) <=
(Convert.ToInt64(strEndRangeLessZero))))
{
|
by: John |
last post by:
Hi
How can I convert a string to long value? Most objects have a toString
method but strings don't have a toLong method.
Thanks
Regards
| |
by: ondekoza |
last post by:
Hello,
I need to convert the string "FFFFFFFF" to a long. To convert this
string I tried the following:
>>> 0xffffffff
-1
>>> 0xffffffffL
4294967295L
OK, this is what I want, so I tried
|
by: XML newbie: Urgent pls help! |
last post by:
Does anyone have a snippet of code that will convert a string to a
long array? I've nearly smashed my head against the wall trying to figure
this out.
I'm Using vb.net 2005
Pls reply asap. I thaanku all in advance. God bless u.
|
by: wenmang |
last post by:
Hi,
I am using following Oracle Proc-C compiler:
Pro*C/C++: Release 8.1.7.0.0 - Production on Thu Jun 15 15:57:32 2006
(c) Copyright 2000 Oracle Corporation. All rights reserved.
I like to use "long long" integer type(64 bit), but it seems that
Oracle doesn't like it after execution, and giving me error code -1460,
any idea about this?
thx
|
by: Ahmed ALZikan |
last post by:
Dear Gent
can help me convert the System.currentTimeMillis to VB.Net code , i
tried system.DateTime.Now.Ticks what is not even close.
--
AlZikan
|
by: Steven Woody |
last post by:
long i = nnn;
long j;
double d;
d = i;
j = ( long )d;
in this case, i == j ?
thanks.
|
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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |