Changeset 22584 in vbox
- Timestamp:
- Aug 31, 2009 6:38:57 AM (15 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 8 edited
-
Graphics/DevVGA.cpp (modified) (2 diffs)
-
Input/DevPS2.cpp (modified) (2 diffs)
-
Network/slirp/slirp.h (modified) (1 diff)
-
Network/slirp/tcp_input.c (modified) (1 diff)
-
PC/DevAPIC.cpp (modified) (1 diff)
-
Serial/DevSerial.cpp (modified) (1 diff)
-
Storage/ISCSIHDDCore.cpp (modified) (1 diff)
-
vl_vbox.h (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r22498 r22584 439 439 #define cbswap_32(__x) \ 440 440 ((uint32_t)( \ 441 (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \442 (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \443 (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \444 (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) ))441 (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ 442 (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \ 443 (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ 444 (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )) 445 445 446 446 #ifdef WORDS_BIGENDIAN … … 567 567 val = s->dac_state; 568 568 break; 569 case 0x3c8:570 val = s->dac_write_index;571 break;569 case 0x3c8: 570 val = s->dac_write_index; 571 break; 572 572 case 0x3c9: 573 573 val = s->palette[s->dac_read_index * 3 + s->dac_sub_index]; -
trunk/src/VBox/Devices/Input/DevPS2.cpp
r22480 r22584 86 86 #endif /* VBOX */ 87 87 88 /* Keyboard Controller Commands */89 #define KBD_CCMD_READ_MODE 0x20/* Read mode bits */90 #define KBD_CCMD_WRITE_MODE 0x60/* Write mode bits */91 #define KBD_CCMD_GET_VERSION 0xA1/* Get controller version */92 #define KBD_CCMD_MOUSE_DISABLE 0xA7/* Disable mouse interface */93 #define KBD_CCMD_MOUSE_ENABLE 0xA8/* Enable mouse interface */94 #define KBD_CCMD_TEST_MOUSE 0xA9/* Mouse interface test */95 #define KBD_CCMD_SELF_TEST 0xAA/* Controller self test */96 #define KBD_CCMD_KBD_TEST 0xAB/* Keyboard interface test */97 #define KBD_CCMD_KBD_DISABLE 0xAD/* Keyboard interface disable */98 #define KBD_CCMD_KBD_ENABLE 0xAE/* Keyboard interface enable */88 /* Keyboard Controller Commands */ 89 #define KBD_CCMD_READ_MODE 0x20 /* Read mode bits */ 90 #define KBD_CCMD_WRITE_MODE 0x60 /* Write mode bits */ 91 #define KBD_CCMD_GET_VERSION 0xA1 /* Get controller version */ 92 #define KBD_CCMD_MOUSE_DISABLE 0xA7 /* Disable mouse interface */ 93 #define KBD_CCMD_MOUSE_ENABLE 0xA8 /* Enable mouse interface */ 94 #define KBD_CCMD_TEST_MOUSE 0xA9 /* Mouse interface test */ 95 #define KBD_CCMD_SELF_TEST 0xAA /* Controller self test */ 96 #define KBD_CCMD_KBD_TEST 0xAB /* Keyboard interface test */ 97 #define KBD_CCMD_KBD_DISABLE 0xAD /* Keyboard interface disable */ 98 #define KBD_CCMD_KBD_ENABLE 0xAE /* Keyboard interface enable */ 99 99 #define KBD_CCMD_READ_INPORT 0xC0 /* read input port */ 100 #define KBD_CCMD_READ_OUTPORT 0xD0 /* read output port */101 #define KBD_CCMD_WRITE_OUTPORT 0xD1 /* write output port */102 #define KBD_CCMD_WRITE_OBUF 0xD2103 #define KBD_CCMD_WRITE_AUX_OBUF 0xD3 /* Write to output buffer as if104 initiated by the auxiliary device */105 #define KBD_CCMD_WRITE_MOUSE 0xD4/* Write the following byte to the mouse */100 #define KBD_CCMD_READ_OUTPORT 0xD0 /* read output port */ 101 #define KBD_CCMD_WRITE_OUTPORT 0xD1 /* write output port */ 102 #define KBD_CCMD_WRITE_OBUF 0xD2 103 #define KBD_CCMD_WRITE_AUX_OBUF 0xD3 /* Write to output buffer as if 104 initiated by the auxiliary device */ 105 #define KBD_CCMD_WRITE_MOUSE 0xD4 /* Write the following byte to the mouse */ 106 106 #define KBD_CCMD_DISABLE_A20 0xDD /* HP vectra only ? */ 107 107 #define KBD_CCMD_ENABLE_A20 0xDF /* HP vectra only ? */ 108 108 #define KBD_CCMD_READ_TSTINP 0xE0 /* Read test inputs T0, T1 */ 109 #define KBD_CCMD_RESET 0xFE109 #define KBD_CCMD_RESET 0xFE 110 110 111 111 /* Keyboard Commands */ 112 #define KBD_CMD_SET_LEDS 0xED/* Set keyboard leds */113 #define KBD_CMD_ECHO 0xEE114 #define KBD_CMD_GET_ID 0xF2/* get keyboard ID */115 #define KBD_CMD_SET_RATE 0xF3/* Set typematic rate */116 #define KBD_CMD_ENABLE 0xF4/* Enable scanning */117 #define KBD_CMD_RESET_DISABLE 0xF5/* reset and disable scanning */118 #define KBD_CMD_RESET_ENABLE 0xF6 /* reset and enable scanning */119 #define KBD_CMD_RESET 0xFF/* Reset */112 #define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */ 113 #define KBD_CMD_ECHO 0xEE 114 #define KBD_CMD_GET_ID 0xF2 /* get keyboard ID */ 115 #define KBD_CMD_SET_RATE 0xF3 /* Set typematic rate */ 116 #define KBD_CMD_ENABLE 0xF4 /* Enable scanning */ 117 #define KBD_CMD_RESET_DISABLE 0xF5 /* reset and disable scanning */ 118 #define KBD_CMD_RESET_ENABLE 0xF6 /* reset and enable scanning */ 119 #define KBD_CMD_RESET 0xFF /* Reset */ 120 120 121 121 /* Keyboard Replies */ 122 #define KBD_REPLY_POR 0xAA/* Power on reset */123 #define KBD_REPLY_ACK 0xFA/* Command ACK */124 #define KBD_REPLY_RESEND 0xFE/* Command NACK, send the cmd again */122 #define KBD_REPLY_POR 0xAA /* Power on reset */ 123 #define KBD_REPLY_ACK 0xFA /* Command ACK */ 124 #define KBD_REPLY_RESEND 0xFE /* Command NACK, send the cmd again */ 125 125 126 126 /* Status Register Bits */ 127 #define KBD_STAT_OBF 0x01/* Keyboard output buffer full */128 #define KBD_STAT_IBF 0x02/* Keyboard input buffer full */129 #define KBD_STAT_SELFTEST 0x04/* Self test successful */130 #define KBD_STAT_CMD 0x08/* Last write was a command write (0=data) */131 #define KBD_STAT_UNLOCKED 0x10/* Zero if keyboard locked */132 #define KBD_STAT_MOUSE_OBF 0x20/* Mouse output buffer full */133 #define KBD_STAT_GTO 0x40/* General receive/xmit timeout */134 #define KBD_STAT_PERR 0x80/* Parity error */127 #define KBD_STAT_OBF 0x01 /* Keyboard output buffer full */ 128 #define KBD_STAT_IBF 0x02 /* Keyboard input buffer full */ 129 #define KBD_STAT_SELFTEST 0x04 /* Self test successful */ 130 #define KBD_STAT_CMD 0x08 /* Last write was a command write (0=data) */ 131 #define KBD_STAT_UNLOCKED 0x10 /* Zero if keyboard locked */ 132 #define KBD_STAT_MOUSE_OBF 0x20 /* Mouse output buffer full */ 133 #define KBD_STAT_GTO 0x40 /* General receive/xmit timeout */ 134 #define KBD_STAT_PERR 0x80 /* Parity error */ 135 135 136 136 /* Controller Mode Register Bits */ 137 #define KBD_MODE_KBD_INT 0x01/* Keyboard data generate IRQ1 */138 #define KBD_MODE_MOUSE_INT 0x02/* Mouse data generate IRQ12 */139 #define KBD_MODE_SYS 0x04/* The system flag (?) */140 #define KBD_MODE_NO_KEYLOCK 0x08/* The keylock doesn't affect the keyboard if set */141 #define KBD_MODE_DISABLE_KBD 0x10/* Disable keyboard interface */142 #define KBD_MODE_DISABLE_MOUSE 0x20/* Disable mouse interface */143 #define KBD_MODE_KCC 0x40/* Scan code conversion to PC format */144 #define KBD_MODE_RFU 0x80137 #define KBD_MODE_KBD_INT 0x01 /* Keyboard data generate IRQ1 */ 138 #define KBD_MODE_MOUSE_INT 0x02 /* Mouse data generate IRQ12 */ 139 #define KBD_MODE_SYS 0x04 /* The system flag (?) */ 140 #define KBD_MODE_NO_KEYLOCK 0x08 /* The keylock doesn't affect the keyboard if set */ 141 #define KBD_MODE_DISABLE_KBD 0x10 /* Disable keyboard interface */ 142 #define KBD_MODE_DISABLE_MOUSE 0x20 /* Disable mouse interface */ 143 #define KBD_MODE_KCC 0x40 /* Scan code conversion to PC format */ 144 #define KBD_MODE_RFU 0x80 145 145 146 146 /* Mouse Commands */ 147 #define AUX_SET_SCALE11 0xE6/* Set 1:1 scaling */148 #define AUX_SET_SCALE21 0xE7/* Set 2:1 scaling */149 #define AUX_SET_RES 0xE8/* Set resolution */150 #define AUX_GET_SCALE 0xE9/* Get scaling factor */151 #define AUX_SET_STREAM 0xEA/* Set stream mode */152 #define AUX_POLL 0xEB/* Poll */153 #define AUX_RESET_WRAP 0xEC/* Reset wrap mode */154 #define AUX_SET_WRAP 0xEE/* Set wrap mode */155 #define AUX_SET_REMOTE 0xF0/* Set remote mode */156 #define AUX_GET_TYPE 0xF2/* Get type */157 #define AUX_SET_SAMPLE 0xF3/* Set sample rate */158 #define AUX_ENABLE_DEV 0xF4/* Enable aux device */159 #define AUX_DISABLE_DEV 0xF5/* Disable aux device */160 #define AUX_SET_DEFAULT 0xF6161 #define AUX_RESET 0xFF/* Reset aux device */162 #define AUX_ACK 0xFA/* Command byte ACK. */163 #ifdef VBOX 164 #define AUX_NACK 0xFE/* Command byte NACK. */147 #define AUX_SET_SCALE11 0xE6 /* Set 1:1 scaling */ 148 #define AUX_SET_SCALE21 0xE7 /* Set 2:1 scaling */ 149 #define AUX_SET_RES 0xE8 /* Set resolution */ 150 #define AUX_GET_SCALE 0xE9 /* Get scaling factor */ 151 #define AUX_SET_STREAM 0xEA /* Set stream mode */ 152 #define AUX_POLL 0xEB /* Poll */ 153 #define AUX_RESET_WRAP 0xEC /* Reset wrap mode */ 154 #define AUX_SET_WRAP 0xEE /* Set wrap mode */ 155 #define AUX_SET_REMOTE 0xF0 /* Set remote mode */ 156 #define AUX_GET_TYPE 0xF2 /* Get type */ 157 #define AUX_SET_SAMPLE 0xF3 /* Set sample rate */ 158 #define AUX_ENABLE_DEV 0xF4 /* Enable aux device */ 159 #define AUX_DISABLE_DEV 0xF5 /* Disable aux device */ 160 #define AUX_SET_DEFAULT 0xF6 161 #define AUX_RESET 0xFF /* Reset aux device */ 162 #define AUX_ACK 0xFA /* Command byte ACK. */ 163 #ifdef VBOX 164 #define AUX_NACK 0xFE /* Command byte NACK. */ 165 165 #endif 166 166 … … 785 785 if (s->mouse_dx == 0 && s->mouse_dy == 0 && s->mouse_dz == 0 && 786 786 s->mouse_buttons == buttons_state) 787 return;787 return; 788 788 #else 789 789 /* This issue does not affect VBox, and under some circumstances (which?) -
trunk/src/VBox/Devices/Network/slirp/slirp.h
r22541 r22584 359 359 # undef calloc 360 360 # undef free 361 # define malloc(x)RTMemAlloc((x))362 # define calloc(x, n) RTMemAllocZ((x)*(n))363 # define free(x)RTMemFree((x))361 # define malloc(x) RTMemAlloc((x)) 362 # define calloc(x, n) RTMemAllocZ((x)*(n)) 363 # define free(x) RTMemFree((x)) 364 364 # ifndef __unused 365 365 # define __unused -
trunk/src/VBox/Devices/Network/slirp/tcp_input.c
r20712 r22584 308 308 so->so_m = 0; 309 309 ti = so->so_ti; 310 /* @todo (r -vvl) clarify why it might happens */ 311 if (ti == NULL) 312 { 313 LogRel(("NAT: ti is null. can't do any reseting connection actions\n")); 314 /* mbuf should be cleared in sofree called from tcp_close */ 315 tcp_close(pData, tp); 316 STAM_PROFILE_STOP(&pData->StatTCP_input, counter_input); 317 return; 318 } 310 311 /** @todo (vvl) clarify why it might happens */ 312 if (ti == NULL) 313 { 314 LogRel(("NAT: ti is null. can't do any reseting connection actions\n")); 315 /* mbuf should be cleared in sofree called from tcp_close */ 316 tcp_close(pData, tp); 317 STAM_PROFILE_STOP(&pData->StatTCP_input, counter_input); 318 return; 319 } 320 319 321 tiwin = ti->ti_win; 320 322 tiflags = ti->ti_flags; -
trunk/src/VBox/Devices/PC/DevAPIC.cpp
r22480 r22584 150 150 151 151 /* APIC delivery modes */ 152 #define APIC_DM_FIXED 0153 #define APIC_DM_LOWPRI 1154 #define APIC_DM_SMI 2155 #define APIC_DM_NMI 4156 #define APIC_DM_INIT 5157 #define APIC_DM_SIPI 6158 #define APIC_DM_EXTINT 7152 #define APIC_DM_FIXED 0 153 #define APIC_DM_LOWPRI 1 154 #define APIC_DM_SMI 2 155 #define APIC_DM_NMI 4 156 #define APIC_DM_INIT 5 157 #define APIC_DM_SIPI 6 158 #define APIC_DM_EXTINT 7 159 159 160 160 /* APIC destination mode */ 161 #define APIC_DESTMODE_FLAT 0xf162 #define APIC_DESTMODE_CLUSTER 1161 #define APIC_DESTMODE_FLAT 0xf 162 #define APIC_DESTMODE_CLUSTER 1 163 163 164 164 #define APIC_TRIGGER_EDGE 0 165 165 #define APIC_TRIGGER_LEVEL 1 166 166 167 #define APIC_LVT_TIMER_PERIODIC(1<<17)168 #define APIC_LVT_MASKED(1<<16)169 #define APIC_LVT_LEVEL_TRIGGER(1<<15)170 #define APIC_LVT_REMOTE_IRR(1<<14)171 #define APIC_INPUT_POLARITY(1<<13)172 #define APIC_SEND_PENDING(1<<12)173 174 #define IOAPIC_NUM_PINS 0x18167 #define APIC_LVT_TIMER_PERIODIC (1<<17) 168 #define APIC_LVT_MASKED (1<<16) 169 #define APIC_LVT_LEVEL_TRIGGER (1<<15) 170 #define APIC_LVT_REMOTE_IRR (1<<14) 171 #define APIC_INPUT_POLARITY (1<<13) 172 #define APIC_SEND_PENDING (1<<12) 173 174 #define IOAPIC_NUM_PINS 0x18 175 175 176 176 #define ESR_ILLEGAL_ADDRESS (1 << 7) -
trunk/src/VBox/Devices/Serial/DevSerial.cpp
r22480 r22584 72 72 #define SERIAL_SAVED_STATE_VERSION 3 73 73 74 #define UART_LCR_DLAB 0x80/* Divisor latch access bit */75 76 #define UART_IER_MSI 0x08/* Enable Modem status interrupt */77 #define UART_IER_RLSI 0x04/* Enable receiver line status interrupt */78 #define UART_IER_THRI 0x02/* Enable Transmitter holding register int. */79 #define UART_IER_RDI 0x01/* Enable receiver data interrupt */80 81 #define UART_IIR_NO_INT 0x01/* No interrupts pending */82 #define UART_IIR_ID 0x06/* Mask for the interrupt ID */83 84 #define UART_IIR_MSI 0x00/* Modem status interrupt */85 #define UART_IIR_THRI 0x02/* Transmitter holding register empty */86 #define UART_IIR_RDI 0x04/* Receiver data interrupt */87 #define UART_IIR_RLSI 0x06/* Receiver line status interrupt */74 #define UART_LCR_DLAB 0x80 /* Divisor latch access bit */ 75 76 #define UART_IER_MSI 0x08 /* Enable Modem status interrupt */ 77 #define UART_IER_RLSI 0x04 /* Enable receiver line status interrupt */ 78 #define UART_IER_THRI 0x02 /* Enable Transmitter holding register int. */ 79 #define UART_IER_RDI 0x01 /* Enable receiver data interrupt */ 80 81 #define UART_IIR_NO_INT 0x01 /* No interrupts pending */ 82 #define UART_IIR_ID 0x06 /* Mask for the interrupt ID */ 83 84 #define UART_IIR_MSI 0x00 /* Modem status interrupt */ 85 #define UART_IIR_THRI 0x02 /* Transmitter holding register empty */ 86 #define UART_IIR_RDI 0x04 /* Receiver data interrupt */ 87 #define UART_IIR_RLSI 0x06 /* Receiver line status interrupt */ 88 88 89 89 /* 90 90 * These are the definitions for the Modem Control Register 91 91 */ 92 #define UART_MCR_LOOP 0x10/* Enable loopback test mode */93 #define UART_MCR_OUT2 0x08/* Out2 complement */94 #define UART_MCR_OUT1 0x04/* Out1 complement */95 #define UART_MCR_RTS 0x02/* RTS complement */96 #define UART_MCR_DTR 0x01/* DTR complement */92 #define UART_MCR_LOOP 0x10 /* Enable loopback test mode */ 93 #define UART_MCR_OUT2 0x08 /* Out2 complement */ 94 #define UART_MCR_OUT1 0x04 /* Out1 complement */ 95 #define UART_MCR_RTS 0x02 /* RTS complement */ 96 #define UART_MCR_DTR 0x01 /* DTR complement */ 97 97 98 98 /* 99 99 * These are the definitions for the Modem Status Register 100 100 */ 101 #define UART_MSR_DCD 0x80/* Data Carrier Detect */102 #define UART_MSR_RI 0x40/* Ring Indicator */103 #define UART_MSR_DSR 0x20/* Data Set Ready */104 #define UART_MSR_CTS 0x10/* Clear to Send */105 #define UART_MSR_DDCD 0x08/* Delta DCD */106 #define UART_MSR_TERI 0x04/* Trailing edge ring indicator */107 #define UART_MSR_DDSR 0x02/* Delta DSR */108 #define UART_MSR_DCTS 0x01/* Delta CTS */109 #define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */110 111 #define UART_LSR_TEMT 0x40/* Transmitter empty */112 #define UART_LSR_THRE 0x20/* Transmit-hold-register empty */113 #define UART_LSR_BI 0x10/* Break interrupt indicator */114 #define UART_LSR_FE 0x08/* Frame error indicator */115 #define UART_LSR_PE 0x04/* Parity error indicator */116 #define UART_LSR_OE 0x02/* Overrun error indicator */117 #define UART_LSR_DR 0x01/* Receiver data ready */101 #define UART_MSR_DCD 0x80 /* Data Carrier Detect */ 102 #define UART_MSR_RI 0x40 /* Ring Indicator */ 103 #define UART_MSR_DSR 0x20 /* Data Set Ready */ 104 #define UART_MSR_CTS 0x10 /* Clear to Send */ 105 #define UART_MSR_DDCD 0x08 /* Delta DCD */ 106 #define UART_MSR_TERI 0x04 /* Trailing edge ring indicator */ 107 #define UART_MSR_DDSR 0x02 /* Delta DSR */ 108 #define UART_MSR_DCTS 0x01 /* Delta CTS */ 109 #define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */ 110 111 #define UART_LSR_TEMT 0x40 /* Transmitter empty */ 112 #define UART_LSR_THRE 0x20 /* Transmit-hold-register empty */ 113 #define UART_LSR_BI 0x10 /* Break interrupt indicator */ 114 #define UART_LSR_FE 0x08 /* Frame error indicator */ 115 #define UART_LSR_PE 0x04 /* Parity error indicator */ 116 #define UART_LSR_OE 0x02 /* Overrun error indicator */ 117 #define UART_LSR_DR 0x01 /* Receiver data ready */ 118 118 119 119 -
trunk/src/VBox/Devices/Storage/ISCSIHDDCore.cpp
r22277 r22584 1755 1755 aReqBHS[0] = RT_H2N_U32(ISCSI_IMMEDIATE_DELIVERY_BIT | ISCSI_FINAL_BIT | ISCSIOP_NOP_OUT); 1756 1756 aReqBHS[1] = RT_H2N_U32(0); /* TotalAHSLength=0,DataSementLength=0 */ 1757 aReqBHS[2] = pcvResSeg[2]; /* copy LUN from NOP-In */1758 aReqBHS[3] = pcvResSeg[3]; /* copy LUN from NOP-In */1757 aReqBHS[2] = pcvResSeg[2]; /* copy LUN from NOP-In */ 1758 aReqBHS[3] = pcvResSeg[3]; /* copy LUN from NOP-In */ 1759 1759 aReqBHS[4] = RT_H2N_U32(ISCSI_TASK_TAG_RSVD); /* ITT, reply */ 1760 aReqBHS[5] = pcvResSeg[5]; /* copy TTT from NOP-In */1760 aReqBHS[5] = pcvResSeg[5]; /* copy TTT from NOP-In */ 1761 1761 aReqBHS[6] = RT_H2N_U32(pImage->CmdSN); 1762 1762 aReqBHS[7] = RT_H2N_U32(pImage->ExpStatSN); -
trunk/src/VBox/Devices/vl_vbox.h
r20374 r22584 58 58 # define _glue(x, y) x ## y 59 59 # define glue(x, y) _glue(x, y) 60 # define tostring(s) #s61 # define stringify(s) tostring(s)60 # define tostring(s) #s 61 # define stringify(s) tostring(s) 62 62 #endif 63 63 … … 194 194 #ifdef _MSC_VER 195 195 #ifndef LITTLE_ENDIAN 196 #define LITTLE_ENDIAN 1234196 #define LITTLE_ENDIAN 1234 197 197 #endif 198 198 #ifndef BYTE_ORDER … … 203 203 { 204 204 return ((uint16_t)( \ 205 (((uint16_t)(x) & (uint16_t)0x00ffU) << 8) | \206 (((uint16_t)(x) & (uint16_t)0xff00U) >> 8) )); \205 (((uint16_t)(x) & (uint16_t)0x00ffU) << 8) | \ 206 (((uint16_t)(x) & (uint16_t)0xff00U) >> 8) )); \ 207 207 } 208 208 … … 210 210 { \ 211 211 return ((uint32_t)( \ 212 (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \213 (((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \214 (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \215 (((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24) )); \212 (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \ 213 (((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \ 214 (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \ 215 (((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24) )); \ 216 216 } 217 217 … … 219 219 { \ 220 220 return ((uint64_t)( \ 221 (uint64_t)(((uint64_t)(x) & (uint64_t)0x00000000000000ffULL) << 56) | \222 (uint64_t)(((uint64_t)(x) & (uint64_t)0x000000000000ff00ULL) << 40) | \223 (uint64_t)(((uint64_t)(x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \224 (uint64_t)(((uint64_t)(x) & (uint64_t)0x00000000ff000000ULL) << 8) | \225 (uint64_t)(((uint64_t)(x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \226 (uint64_t)(((uint64_t)(x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \227 (uint64_t)(((uint64_t)(x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \228 (uint64_t)(((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \221 (uint64_t)(((uint64_t)(x) & (uint64_t)0x00000000000000ffULL) << 56) | \ 222 (uint64_t)(((uint64_t)(x) & (uint64_t)0x000000000000ff00ULL) << 40) | \ 223 (uint64_t)(((uint64_t)(x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \ 224 (uint64_t)(((uint64_t)(x) & (uint64_t)0x00000000ff000000ULL) << 8) | \ 225 (uint64_t)(((uint64_t)(x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \ 226 (uint64_t)(((uint64_t)(x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \ 227 (uint64_t)(((uint64_t)(x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \ 228 (uint64_t)(((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \ 229 229 } 230 230 … … 234 234 235 235 #ifndef LITTLE_ENDIAN 236 #define LITTLE_ENDIAN 1234236 #define LITTLE_ENDIAN 1234 237 237 #endif 238 238 #ifndef BYTE_ORDER … … 242 242 #define bswap_16(x) \ 243 243 (__extension__ ({ \ 244 uint16_t __x = (x); \245 ((uint16_t)( \246 (((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \247 (((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \244 uint16_t __x = (x); \ 245 ((uint16_t)( \ 246 (((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \ 247 (((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \ 248 248 })) 249 249 250 250 #define bswap_32(x) \ 251 251 (__extension__ ({ \ 252 uint32_t __x = (x); \253 ((uint32_t)( \254 (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \255 (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \256 (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \257 (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \252 uint32_t __x = (x); \ 253 ((uint32_t)( \ 254 (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ 255 (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \ 256 (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ 257 (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \ 258 258 })) 259 259 260 260 #define bswap_64(x) \ 261 261 (__extension__ ({ \ 262 uint64_t __x = (x); \263 ((uint64_t)( \264 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \265 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \266 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \267 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) << 8) | \268 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \269 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \270 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \271 (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \262 uint64_t __x = (x); \ 263 ((uint64_t)( \ 264 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \ 265 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \ 266 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \ 267 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) << 8) | \ 268 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \ 269 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \ 270 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \ 271 (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \ 272 272 })) 273 273 #endif
Note:
See TracChangeset
for help on using the changeset viewer.

