Sponsored Content
Operating Systems Linux Red Hat Double data type C Red Hat platform problem Post 302957037 by Corona688 on Tuesday 6th of October 2015 12:03:00 PM
Old 10-06-2015
It likely needs to be byte-swapped.

Code:
#include <stdint.h>

void swap64(void *mem) {
        uint64_t x=*((uint64_t *)mem)
        x = (x & 0x00000000FFFFFFFF) << 32 | (x & 0xFFFFFFFF00000000) >> 32;
        x = (x & 0x0000FFFF0000FFFF) << 16 | (x & 0xFFFF0000FFFF0000) >> 16;
        x = (x & 0x00FF00FF00FF00FF) << 8  | (x & 0xFF00FF00FF00FF00) >> 8;
        *((uint64_t *)mem)=x;
}

...

memcpy(&longi,&rbuff[503],8);
swap64(&longi); // Only do this on systems of differing endian from file

Code adapted from here.
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problem Downloading Red Hat

I've been having problems downloading Red Hat 7.2 from their FTP site. It downloads rather slowly(between 2-3k/sec, I'm on broadband) and after about 10 minutes stops downloading altogether. Am I doing something wrong? (2 Replies)
Discussion started by: Tradewynd
2 Replies

2. UNIX for Dummies Questions & Answers

Please Help Me With This Linux Red Hat 7.2 Modem Problem

I cant get my modem to work. Linux just isn't recognizing it. every time I typed wvdial, i get a message saying my modem is not responding I tried looking for drivers at the website Neo directed me to but I just couldn't find the right one from the information I was given about my modem... (2 Replies)
Discussion started by: TRUEST
2 Replies

3. UNIX for Dummies Questions & Answers

Linux Red Hat 7.2 Problem

how come red hat doesn't have this programs which was already supposed to be on it?? take for instance, I was reading this Linux book that says for me to do some work in glint X11 client for packagement. it says glint is accessible from the command line or control panel. the problem is, I... (4 Replies)
Discussion started by: TRUEST
4 Replies

4. UNIX Desktop Questions & Answers

Red Hat loading problem

when i try to load Redhat 7.2 the screen gets all mished together as if it were a meltdown the book says its a prob with X but it dosnt really say what to do WINMe works fine i have a radeon 64 MB card 1 gig processor and 2 HDs on a Dell 1 GHZ how do i fix this ? (1 Reply)
Discussion started by: ASpin
1 Replies

5. Linux

Red Hat RPM problem

I have my system setup different then the conventional setup: # df -h Filesystem Size Used Avail Use% Mounted on /dev/hdc2 2.0G 977M 936M 52% / /dev/hdc1 97M 9.0M 83M 10% /boot none 251M 0 251M 0% /dev/shm So when I try... (2 Replies)
Discussion started by: jasonr
2 Replies

6. Linux

Installation Problem on Red hat linux 9

Hi, I am trying to install our new acquired Red Hat linux 9 on Compaq Proliant ML370. However, l has already configured the raid 0+1. The linux installation starts from the CD, its allows for the selection of Language, keyboard but l am stocked at choosing the installation package media. I... (4 Replies)
Discussion started by: kayode
4 Replies

7. UNIX for Dummies Questions & Answers

Problem Red Hat 9 Installation

I have a problem with a red hat 9 install on a compaq laptop. I installed the OS and everything tests ok but It boots to a blank screen instead of the GUI login I wanted. What can I do to correct this instead of installing all over. I tried the rescue option several times and tried to run... (2 Replies)
Discussion started by: vedder191
2 Replies

8. Red Hat

Clustering Red Hat Enterprise linux Advanced Platform 5.2 (x86-64 bit)

Hello Professionals, We have high-end HP rack servers. We need to provide application fail-over for business continuity. We have done benchmarking of the application on RHEL 5.2 on HP servers to estimate the hardware requirement so as to meet next 3-5 years business growth. Presently we... (1 Reply)
Discussion started by: kgayyar
1 Replies

9. Infrastructure Monitoring

Problem Installing Cacti on Red Hat

Can someone please point me in the direction of where I can find out how to install cacti? there doesn't seem to be straightforward steps for it. after downloading the tar.gz file from cacti.net, there's basically no instructions of what to do from that point on. any help will be appreciated. ... (1 Reply)
Discussion started by: SkySmart
1 Replies

10. Fedora

Which is the better platform to learn UNIX/Linux (Kali Linux Vs. Red Hat or other)?

I just started a new semester and I started my UNIX class yesterday. I've already decided to use python along with my learning process but what I really want to use with it is Kali as my UNIX/Linux platform to learn off of since I already wanted to learn Cyber Sec. anyways. I just wanted to know if... (12 Replies)
Discussion started by: ApacheOmega
12 Replies
BYTEORDER(9)						   BSD Kernel Developer's Manual					      BYTEORDER(9)

NAME
bswap16, bswap32, bswap64, be16toh, be32toh, be64toh, htobe16, htobe32, htobe64, htole16, htole32, htole64, le16toh, le32toh, le64toh, be16enc, be16dec, be32enc, be32dec, be64enc, be64dec, le16enc, le16dec, le32enc, le32dec, le64enc, le64dec -- byte order operations SYNOPSIS
#include <sys/endian.h> uint16_t bswap16(uint16_t int16); uint32_t bswap32(uint32_t int32); uint64_t bswap64(uint64_t int64); uint16_t be16toh(uint16_t big16); uint32_t be32toh(uint32_t big32); uint64_t be64toh(uint64_t big64); uint16_t htobe16(uint16_t host16); uint32_t htobe32(uint32_t host32); uint64_t htobe64(uint64_t host64); uint16_t htole16(uint16_t host16); uint32_t htole32(uint32_t host32); uint64_t htole64(uint64_t host64); uint16_t le16toh(uint16_t little16); uint32_t le32toh(uint32_t little32); uint64_t le64toh(uint64_t little64); uint16_t be16dec(const void *); uint32_t be32dec(const void *); uint64_t be64dec(const void *); uint16_t le16dec(const void *); uint32_t le32dec(const void *); uint64_t le64dec(const void *); void be16enc(void *, uint16_t); void be32enc(void *, uint32_t); void be64enc(void *, uint64_t); void le16enc(void *, uint16_t); void le32enc(void *, uint32_t); void le64enc(void *, uint64_t); DESCRIPTION
The bswap16(), bswap32(), and bswap64() functions return a byte order swapped integer. On big endian systems, the number is converted to little endian byte order. On little endian systems, the number is converted to big endian byte order. The be16toh(), be32toh(), and be64toh() functions return a big endian byte ordered integer converted to the system's native byte order. The return value will be the same as the argument on big endian systems. The le16toh(), le32toh(), and le64toh() functions return a little endian byte ordered integer converted to the system's native byte order. The return value will be the same as the argument on little endian systems. The htobe16(), htobe32(), and htobe64() functions return a integer in the system's native byte order converted to big endian byte order. The return value will be the same as the argument on big endian systems. The htole16(), htole32(), and htole64() functions return a integer in the system's native byte order converted to little endian byte order. The return value will be the same as the argument on little endian systems. The be16enc(), be16dec(), be32enc(), be32dec(), be64enc(), be64dec(), le16enc(), le16dec(), le32enc(), le32dec(), le64enc(), and le64dec() functions encode and decode integers to/from byte strings on any alignment in big/little endian format. SEE ALSO
byteorder(3) HISTORY
The hto*() and toh*() functions first appeared in FreeBSD 5.0, and were originally developed by the NetBSD project. The encode/decode functions first appeared in FreeBSD 5.1. BSD
April 29, 2002 BSD
All times are GMT -4. The time now is 04:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy