您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ swapl函数代码示例

51自学网 2021-06-03 08:34:48
  C++
这篇教程C++ swapl函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中swapl函数的典型用法代码示例。如果您正苦于以下问题:C++ swapl函数的具体用法?C++ swapl怎么用?C++ swapl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了swapl函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: reply_XIPassiveGrabDevice

static void reply_XIPassiveGrabDevice(ClientPtr client, int len, char *data, void *userdata){    xXIPassiveGrabDeviceReply *rep = (xXIPassiveGrabDeviceReply*)data;    if (client->swapped)    {        swaps(&rep->sequenceNumber);        swapl(&rep->length);        swaps(&rep->num_modifiers);        testdata.num_modifiers = rep->num_modifiers;    }    reply_check_defaults(rep, len, XIPassiveGrabDevice);    /* ProcXIPassiveGrabDevice sends the data in two batches, let the second     * handler handle the modifier data */    if (rep->num_modifiers > 0)        reply_handler = reply_XIPassiveGrabDevice_data;}
开发者ID:4eremuxa,项目名称:xserver,代码行数:20,


示例2: pciconfig_write

int pciconfig_write(          unsigned char bus,          unsigned char dev,          unsigned char offset,          int len,		/* unused, alway 4 */          unsigned long val){	unsigned long _val;	unsigned long *ptr;	dev >>= 3;	_val = swapl(val);	if (bus || dev >= 16) {		return PCIBIOS_DEVICE_NOT_FOUND;	} else {		ptr = (unsigned long *)(pciConfBase + ((1<<dev) | offset));		*ptr = _val;	}	return PCIBIOS_SUCCESSFUL;}
开发者ID:hanyong,项目名称:mplayer-kovensky,代码行数:20,


示例3: ProcRRXineramaQueryVersion

intProcRRXineramaQueryVersion(ClientPtr client){    xPanoramiXQueryVersionReply rep;    REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);    rep.type = X_Reply;    rep.sequenceNumber = client->sequence;    rep.length = 0;    rep.majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION;    rep.minorVersion = SERVER_RRXINERAMA_MINOR_VERSION;    if (client->swapped) {        swaps(&rep.sequenceNumber);        swapl(&rep.length);        swaps(&rep.majorVersion);        swaps(&rep.minorVersion);    }    WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), &rep);    return Success;}
开发者ID:erdincay,项目名称:vcxsrv-linux2windows,代码行数:20,


示例4: XkbSendMapNotify

voidXkbSendMapNotify(DeviceIntPtr kbd,xkbMapNotify *pMN){int 		i;XkbSrvInfoPtr	xkbi;unsigned	time = 0,initialized;CARD16		changed;    xkbi = kbd->key->xkbInfo;    initialized= 0;    changed = pMN->changed;    pMN->minKeyCode= xkbi->desc->min_key_code;    pMN->maxKeyCode= xkbi->desc->max_key_code;    for (i=1; i<currentMaxClients; i++) {        if (clients[i] && ! clients[i]->clientGone &&	    (clients[i]->requestVector != InitialVector) &&	    (clients[i]->xkbClientFlags&_XkbClientInitialized) &&	    (clients[i]->mapNotifyMask&changed))	{	    if (!initialized) {		pMN->type = XkbEventCode + XkbEventBase;		pMN->xkbType = XkbMapNotify;		pMN->deviceID = kbd->id;		time = GetTimeInMillis();		initialized= 1;	    }	    pMN->time= time;	    pMN->sequenceNumber = clients[i]->sequence;	    pMN->changed = changed;	    if ( clients[i]->swapped ) {		register int n;		swaps(&pMN->sequenceNumber,n);		swapl(&pMN->time,n);		swaps(&pMN->changed,n);	    }	    WriteToClient(clients[i],sizeof(xEvent),(char *)pMN);	}    }    return;}
开发者ID:aosm,项目名称:X11,代码行数:41,


示例5: ProcShapeQueryVersion

static intProcShapeQueryVersion(ClientPtr client){    xShapeQueryVersionReply rep;    REQUEST_SIZE_MATCH(xShapeQueryVersionReq);    memset(&rep, 0, sizeof(xShapeQueryVersionReply));    rep.type = X_Reply;    rep.length = 0;    rep.sequenceNumber = client->sequence;    rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION;    rep.minorVersion = SERVER_SHAPE_MINOR_VERSION;    if (client->swapped) {        swaps(&rep.sequenceNumber);        swapl(&rep.length);        swaps(&rep.majorVersion);        swaps(&rep.minorVersion);    }    WriteToClient(client, sizeof(xShapeQueryVersionReply), (char *) &rep);    return Success;}
开发者ID:coffee8651,项目名称:turbovnc,代码行数:21,


示例6: ProcAppleDRIQueryVersion

static intProcAppleDRIQueryVersion(    register ClientPtr client){    xAppleDRIQueryVersionReply rep;    REQUEST_SIZE_MATCH(xAppleDRIQueryVersionReq);    rep.type = X_Reply;    rep.length = 0;    rep.sequenceNumber = client->sequence;    rep.majorVersion = SERVER_APPLEDRI_MAJOR_VERSION;    rep.minorVersion = SERVER_APPLEDRI_MINOR_VERSION;    rep.patchVersion = SERVER_APPLEDRI_PATCH_VERSION;    if (client->swapped) {        swaps(&rep.sequenceNumber);        swapl(&rep.length);    }    WriteToClient(client, sizeof(xAppleDRIQueryVersionReply), (char *)&rep);    return Success;}
开发者ID:AK47POMA,项目名称:xserver,代码行数:21,


示例7: ProcEVIQueryVersion

static intProcEVIQueryVersion(ClientPtr client){    /* REQUEST(xEVIQueryVersionReq); */    xEVIQueryVersionReply rep;    register int n;    REQUEST_SIZE_MATCH (xEVIQueryVersionReq);    rep.type = X_Reply;    rep.length = 0;    rep.sequenceNumber = client->sequence;    rep.majorVersion = XEVI_MAJOR_VERSION;    rep.minorVersion = XEVI_MAJOR_VERSION;    if (client->swapped) {    	swaps(&rep.sequenceNumber, n);    	swapl(&rep.length, n);	swaps(&rep.majorVersion, n);	swaps(&rep.minorVersion, n);    }    WriteToClient(client, sizeof (xEVIQueryVersionReply), (char *)&rep);    return (client->noClientException);}
开发者ID:dimkr,项目名称:tinyxserver,代码行数:21,


示例8: pciconfig_read

int pciconfig_read(    unsigned char bus,    unsigned char dev,    unsigned char offset,    int len,		/* unused, alway 4 */    unsigned long *val){    unsigned long _val;    unsigned long *ptr;    dev >>= 3;    if (bus || dev >= 16) {        *val = 0xFFFFFFFF;        return PCIBIOS_DEVICE_NOT_FOUND;    } else {        ptr = (unsigned long *)(pciConfBase + ((1<<dev) | offset));        _val = swapl(*ptr);    }    *val = _val;    return PCIBIOS_SUCCESSFUL;}
开发者ID:WilliamRen,项目名称:mplayer-android,代码行数:21,


示例9: ResetCurrentRequest

voidResetCurrentRequest(ClientPtr client){    OsCommPtr oc = (OsCommPtr) client->osPrivate;    register ConnectionInputPtr oci = oc->input;    int fd = oc->fd;    register xReq *request;    int gotnow, needed;    if (AvailableInput == oc)        AvailableInput = (OsCommPtr) NULL;    oci->lenLastReq = 0;    gotnow = oci->bufcnt + oci->buffer - oci->bufptr;    if (gotnow < sizeof(xReq)) {        YieldControlNoInput(fd);    }    else {        request = (xReq *) oci->bufptr;        needed = get_req_len(request, client);        if (!needed && client->big_requests) {            oci->bufptr -= sizeof(xBigReq) - sizeof(xReq);            *(xReq *) oci->bufptr = *request;            ((xBigReq *) oci->bufptr)->length = client->req_len;            if (client->swapped) {                swapl(&((xBigReq *) oci->bufptr)->length);            }        }        if (gotnow >= (needed << 2)) {            if (FD_ISSET(fd, &AllClients)) {                FD_SET(fd, &ClientsWithInput);            }            else {                FD_SET(fd, &IgnoredClientsWithInput);            }            YieldControl();        }        else            YieldControlNoInput(fd);    }}
开发者ID:theqvd,项目名称:vcxsrv,代码行数:40,


示例10: ProcShapeInputSelected

static intProcShapeInputSelected(ClientPtr client){    REQUEST(xShapeInputSelectedReq);    WindowPtr pWin;    ShapeEventPtr pShapeEvent, *pHead;    int enabled, rc;    xShapeInputSelectedReply rep;    REQUEST_SIZE_MATCH(xShapeInputSelectedReq);    rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);    if (rc != Success)        return rc;    rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,                                 ShapeEventType, client, DixReadAccess);    if (rc != Success && rc != BadValue)        return rc;    enabled = xFalse;    if (pHead) {        for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {            if (pShapeEvent->client == client) {                enabled = xTrue;                break;            }        }    }    rep.type = X_Reply;    rep.enabled = enabled;    rep.sequenceNumber = client->sequence;    rep.length = 0;    if (client->swapped) {        swaps(&rep.sequenceNumber);        swapl(&rep.length);    }    WriteToClient(client, sizeof(xShapeInputSelectedReply), &rep);    return Success;}
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:39,


示例11: ProcAppleWMQueryVersion

static intProcAppleWMQueryVersion(    register ClientPtr client){    xAppleWMQueryVersionReply rep;    register int n;    REQUEST_SIZE_MATCH(xAppleWMQueryVersionReq);    rep.type = X_Reply;    rep.length = 0;    rep.sequenceNumber = client->sequence;    rep.majorVersion = APPLE_WM_MAJOR_VERSION;    rep.minorVersion = APPLE_WM_MINOR_VERSION;    rep.patchVersion = APPLE_WM_PATCH_VERSION;    if (client->swapped) {    	swaps(&rep.sequenceNumber, n);    	swapl(&rep.length, n);    }    WriteToClient(client, sizeof(xAppleWMQueryVersionReply), (char *)&rep);    return (client->noClientException);}
开发者ID:BakaMANIA,项目名称:synfig,代码行数:22,


示例12: ProcXResQueryVersion

static intProcXResQueryVersion (ClientPtr client){    REQUEST(xXResQueryVersionReq);    xXResQueryVersionReply rep;    REQUEST_SIZE_MATCH (xXResQueryVersionReq);    rep.type = X_Reply;    rep.length = 0;    rep.sequenceNumber = client->sequence;    rep.server_major = SERVER_XRES_MAJOR_VERSION;    rep.server_minor = SERVER_XRES_MINOR_VERSION;    if (client->swapped) {         swaps(&rep.sequenceNumber);        swapl(&rep.length);        swaps(&rep.server_major);        swaps(&rep.server_minor);    }    WriteToClient(client, sizeof (xXResQueryVersionReply), (char *)&rep);    return Success;}
开发者ID:timon37,项目名称:xwayland,代码行数:22,


示例13: ProcXF86DRIQueryDirectRenderingCapable

static intProcXF86DRIQueryDirectRenderingCapable(    register ClientPtr client){    xXF86DRIQueryDirectRenderingCapableReply	rep;    Bool isCapable;    register int n;    REQUEST(xXF86DRIQueryDirectRenderingCapableReq);    REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq);    if (stuff->screen >= screenInfo.numScreens) {	client->errorValue = stuff->screen;	return BadValue;    }    rep.type = X_Reply;    rep.length = 0;    rep.sequenceNumber = client->sequence;    if (!DRIQueryDirectRenderingCapable( screenInfo.screens[stuff->screen], 					 &isCapable)) {	return BadValue;    }    rep.isCapable = isCapable;    if (!LocalClient(client) || client->swapped)	rep.isCapable = 0;    if (client->swapped) {    	swaps(&rep.sequenceNumber, n);    	swapl(&rep.length, n);    }    WriteToClient(client, 	sizeof(xXF86DRIQueryDirectRenderingCapableReply), (char *)&rep);    return (client->noClientException);}
开发者ID:mcr,项目名称:xorg-xvnc4,代码行数:38,


示例14: XkbSendNewKeyboardNotify

voidXkbSendNewKeyboardNotify(DeviceIntPtr kbd, xkbNewKeyboardNotify * pNKN){    int i;    Time time = GetTimeInMillis();    CARD16 changed = pNKN->changed;    pNKN->type = XkbEventCode + XkbEventBase;    pNKN->xkbType = XkbNewKeyboardNotify;    for (i = 1; i < currentMaxClients; i++) {        if (!clients[i] || clients[i]->clientState != ClientStateRunning)            continue;        if (!(clients[i]->newKeyboardNotifyMask & changed))            continue;        pNKN->sequenceNumber = clients[i]->sequence;        pNKN->time = time;        pNKN->changed = changed;        if (clients[i]->swapped) {            swaps(&pNKN->sequenceNumber);            swapl(&pNKN->time);            swaps(&pNKN->changed);        }        WriteToClient(clients[i], sizeof(xEvent), pNKN);        if (changed & XkbNKN_KeycodesMask) {            clients[i]->minKC = pNKN->minKeyCode;            clients[i]->maxKC = pNKN->maxKeyCode;        }    }    XkbSendLegacyMapNotify(kbd, XkbNewKeyboardNotify, changed, pNKN->minKeyCode,                           pNKN->maxKeyCode - pNKN->minKeyCode + 1);    return;}
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:38,


示例15: reply_XIPassiveGrabDevice_data

static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len, char *data, void *userdata){    int i;    xXIGrabModifierInfo *mods = (xXIGrabModifierInfo*)data;    for (i = 0; i < testdata.num_modifiers; i++, mods++)    {        if (client->swapped)            swapl(&mods->modifiers);        /* 1 - 7 is the range we use for the global modifiers array         * above */        assert(mods->modifiers > 0);        assert(mods->modifiers <= 7);        assert(mods->modifiers % 2 == 1); /* because we fail odd ones */        assert(mods->status != Success);        assert(mods->pad0 == 0);        assert(mods->pad1 == 0);    }    reply_handler = reply_XIPassiveGrabDevice;}
开发者ID:4eremuxa,项目名称:xserver,代码行数:23,


示例16: SRawEvent

static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to){    char n;    int i;    FP3232 *values;    unsigned char *mask;    memcpy(to, from, sizeof(xEvent) + from->length * 4);    swaps(&to->sequenceNumber, n);    swapl(&to->length, n);    swaps(&to->evtype, n);    swaps(&to->deviceid, n);    swapl(&to->time, n);    swapl(&to->detail, n);    mask = (unsigned char*)&to[1];    values = (FP3232*)(mask + from->valuators_len * 4);    for (i = 0; i < from->valuators_len * 4 * 8; i++)    {        if (BitIsOn(mask, i))        {            /* for each bit set there are two FP3232 values on the wire, in             * the order abcABC for data and data_raw. Here we swap as if             * they were in aAbBcC order because it's easier and really             * doesn't matter.             */            swapl(&values->integral, n);            swapl(&values->frac, n);            values++;            swapl(&values->integral, n);            swapl(&values->frac, n);            values++;        }    }    swaps(&to->valuators_len, n);}
开发者ID:nikai3d,项目名称:xserver,代码行数:40,


示例17: ProcXagQueryVersion

static int ProcXagQueryVersion(    register ClientPtr client){    /* REQUEST (xXagQueryVersionReq); */    xXagQueryVersionReply rep;    register int n;    REQUEST_SIZE_MATCH (xXagQueryVersionReq);    rep.type = X_Reply;    rep.length = 0;    rep.sequence_number = client->sequence;    rep.server_major_version = XAG_MAJOR_VERSION;    rep.server_minor_version = XAG_MINOR_VERSION;    if (client->swapped) {    	swaps (&rep.sequence_number, n);    	swapl (&rep.length, n);    	swaps (&rep.server_major_version, n);    	swaps (&rep.server_minor_version, n);    }    WriteToClient (client, sizeof (xXagQueryVersionReply), (char *)&rep);    return client->noClientException;}
开发者ID:Magister,项目名称:x11rdp_xorg71,代码行数:23,


示例18: XkbSendMapNotify

/* * This function sends out XKB mapping notify events to clients which * have explicitly selected for them.  Core and Xi events are handled by * XkbSendLegacyMapNotify. */voidXkbSendMapNotify(DeviceIntPtr kbd, xkbMapNotify * pMN){    int i;    CARD32 time = GetTimeInMillis();    CARD16 changed = pMN->changed;    XkbSrvInfoPtr xkbi = kbd->key->xkbInfo;    pMN->minKeyCode = xkbi->desc->min_key_code;    pMN->maxKeyCode = xkbi->desc->max_key_code;    pMN->type = XkbEventCode + XkbEventBase;    pMN->xkbType = XkbMapNotify;    pMN->deviceID = kbd->id;    /* 0 is serverClient. */    for (i = 1; i < currentMaxClients; i++) {        if (!clients[i] || clients[i]->clientState != ClientStateRunning)            continue;        if (!(clients[i]->mapNotifyMask & changed))            continue;        pMN->time = time;        pMN->sequenceNumber = clients[i]->sequence;        pMN->changed = changed;        if (clients[i]->swapped) {            swaps(&pMN->sequenceNumber);            swapl(&pMN->time);            swaps(&pMN->changed);        }        WriteToClient(clients[i], sizeof(xEvent), pMN);    }    XkbSendLegacyMapNotify(kbd, XkbMapNotify, changed, pMN->firstKeySym,                           pMN->nKeySyms);}
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:41,


示例19: request_XISetClientPointer

static voidrequest_XISetClientPointer(xXISetClientPointerReq * req, int error){    int rc;    client_request = init_client(req->length, req);    rc = ProcXISetClientPointer(&client_request);    assert(rc == error);    if (rc == BadDevice)        assert(client_request.errorValue == req->deviceid);    client_request.swapped = TRUE;    swapl(&req->win);    swaps(&req->length);    swaps(&req->deviceid);    rc = SProcXISetClientPointer(&client_request);    assert(rc == error);    if (rc == BadDevice)        assert(client_request.errorValue == req->deviceid);}
开发者ID:Agnesa,项目名称:xserver,代码行数:24,


示例20: request_XIGetClientPointer

static voidrequest_XIGetClientPointer(ClientPtr client, xXIGetClientPointerReq * req,                           int error){    int rc;    test_data.win = req->win;    rc = ProcXIGetClientPointer(&client_request);    assert(rc == error);    if (rc == BadWindow)        assert(client_request.errorValue == req->win);    client_request.swapped = TRUE;    swapl(&req->win);    swaps(&req->length);    rc = SProcXIGetClientPointer(&client_request);    assert(rc == error);    if (rc == BadWindow)        assert(client_request.errorValue == req->win);}
开发者ID:Agnesa,项目名称:xserver,代码行数:24,


示例21: SProcRRSetCrtcTransform

static int _X_COLDSProcRRSetCrtcTransform(ClientPtr client){    int nparams;    char *filter;    CARD32 *params;    REQUEST(xRRSetCrtcTransformReq);    REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);    swaps(&stuff->length);    swapl(&stuff->crtc);    SwapLongs((CARD32 *) &stuff->transform,              bytes_to_int32(sizeof(xRenderTransform)));    swaps(&stuff->nbytesFilter);    filter = (char *) (stuff + 1);    params = (CARD32 *) (filter + pad_to_int32(stuff->nbytesFilter));    nparams = ((CARD32 *) stuff + client->req_len) - params;    if (nparams < 0)        return BadLength;    SwapLongs(params, nparams);    return (*ProcRandrVector[stuff->randrReqType]) (client);}
开发者ID:mirror,项目名称:xserver,代码行数:24,


示例22: reply_XIQueryDevice

/* reply handling for the first bytes that constitute the reply */static void reply_XIQueryDevice(ClientPtr client, int len, char* data, void *userdata){    xXIQueryDeviceReply *rep = (xXIQueryDeviceReply*)data;    struct test_data *querydata = (struct test_data*)userdata;    if (client->swapped)    {        swapl(&rep->length);        swaps(&rep->sequenceNumber);        swaps(&rep->num_devices);    }    reply_check_defaults(rep, len, XIQueryDevice);    if (querydata->which_device == XIAllDevices)        assert(rep->num_devices == devices.num_devices);    else if (querydata->which_device == XIAllMasterDevices)        assert(rep->num_devices == devices.num_master_devices);    else        assert(rep->num_devices == 1);    querydata->num_devices_in_reply = rep->num_devices;    reply_handler = reply_XIQueryDevice_data;}
开发者ID:4eremuxa,项目名称:xserver,代码行数:25,


示例23: SProcXvShmPutImage

static intSProcXvShmPutImage(ClientPtr client){  REQUEST(xvShmPutImageReq);  swaps(&stuff->length);  swapl(&stuff->port);  swapl(&stuff->drawable);  swapl(&stuff->gc);  swapl(&stuff->shmseg);  swapl(&stuff->id);  swapl(&stuff->offset);  swaps(&stuff->src_x);  swaps(&stuff->src_y);  swaps(&stuff->src_w);  swaps(&stuff->src_h);  swaps(&stuff->drw_x);  swaps(&stuff->drw_y);  swaps(&stuff->drw_w);  swaps(&stuff->drw_h);  swaps(&stuff->width);  swaps(&stuff->height);  return XvProcVector[xv_ShmPutImage](client);}
开发者ID:timon37,项目名称:xwayland,代码行数:23,


示例24: SProcXvShmPutImage

static intSProcXvShmPutImage(ClientPtr client){  char n;  REQUEST(xvShmPutImageReq);  swaps(&stuff->length, n);  swapl(&stuff->port, n);  swapl(&stuff->drawable, n);  swapl(&stuff->gc, n);  swapl(&stuff->shmseg, n);  swapl(&stuff->id, n);  swapl(&stuff->offset, n);  swaps(&stuff->src_x, n);  swaps(&stuff->src_y, n);  swaps(&stuff->src_w, n);  swaps(&stuff->src_h, n);  swaps(&stuff->drw_x, n);  swaps(&stuff->drw_y, n);  swaps(&stuff->drw_w, n);  swaps(&stuff->drw_h, n);  swaps(&stuff->width, n);  swaps(&stuff->height, n);  return XvProcVector[xv_ShmPutImage](client);}
开发者ID:eriytt,项目名称:xserver-xsdl,代码行数:24,


示例25: SDeviceEvent

static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to){    int i;    char n;    char *ptr;    char *vmask;    memcpy(to, from, sizeof(xEvent) + from->length * 4);    swaps(&to->sequenceNumber, n);    swapl(&to->length, n);    swaps(&to->evtype, n);    swaps(&to->deviceid, n);    swapl(&to->time, n);    swapl(&to->detail, n);    swapl(&to->root, n);    swapl(&to->event, n);    swapl(&to->child, n);    swapl(&to->root_x, n);    swapl(&to->root_y, n);    swapl(&to->event_x, n);    swapl(&to->event_y, n);    swaps(&to->buttons_len, n);    swaps(&to->valuators_len, n);    swaps(&to->sourceid, n);    swapl(&to->mods.base_mods, n);    swapl(&to->mods.latched_mods, n);    swapl(&to->mods.locked_mods, n);    swapl(&to->mods.effective_mods, n);    swapl(&to->flags, n);    ptr = (char*)(&to[1]);    ptr += from->buttons_len * 4;    vmask = ptr; /* valuator mask */    ptr += from->valuators_len * 4;    for (i = 0; i < from->valuators_len * 32; i++)    {        if (BitIsOn(vmask, i))        {            swapl(((uint32_t*)ptr), n);            ptr += 4;            swapl(((uint32_t*)ptr), n);            ptr += 4;        }    }}
开发者ID:nikai3d,项目名称:xserver,代码行数:46,


示例26: SDeviceChangedEvent

static voidSDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to){    char n;    int i, j;    xXIAnyInfo *any;    *to = *from;    memcpy(&to[1], &from[1], from->length * 4);    any = (xXIAnyInfo*)&to[1];    for (i = 0; i < to->num_classes; i++)    {        int length = any->length;        switch(any->type)        {        case KeyClass:        {            xXIKeyInfo *ki = (xXIKeyInfo*)any;            uint32_t *key = (uint32_t*)&ki[1];            for (j = 0; j < ki->num_keycodes; j++, key++)                swapl(key, n);            swaps(&ki->num_keycodes, n);        }        break;        case ButtonClass:        {            xXIButtonInfo *bi = (xXIButtonInfo*)any;            Atom *labels = (Atom*)((char*)bi + sizeof(xXIButtonInfo) +                                   pad_to_int32(bits_to_bytes(bi->num_buttons)));            for (j = 0; j < bi->num_buttons; j++)                swapl(&labels[j], n);            swaps(&bi->num_buttons, n);        }        break;        case ValuatorClass:        {            xXIValuatorInfo* ai = (xXIValuatorInfo*)any;            swapl(&ai->label, n);            swapl(&ai->min.integral, n);            swapl(&ai->min.frac, n);            swapl(&ai->max.integral, n);            swapl(&ai->max.frac, n);            swapl(&ai->resolution, n);            swaps(&ai->number, n);        }        break;        }        swaps(&any->type, n);        swaps(&any->length, n);        swaps(&any->sourceid, n);        any = (xXIAnyInfo*)((char*)any + length * 4);    }    swaps(&to->sequenceNumber, n);    swapl(&to->length, n);    swaps(&to->evtype, n);    swaps(&to->deviceid, n);    swapl(&to->time, n);    swaps(&to->num_classes, n);    swaps(&to->sourceid, n);}
开发者ID:nikai3d,项目名称:xserver,代码行数:66,


示例27: SDeviceLeaveNotifyEvent

static voidSDeviceLeaveNotifyEvent (xXILeaveEvent *from, xXILeaveEvent *to){    char n;    *to = *from;    swaps(&to->sequenceNumber,n);    swapl(&to->length, n);    swaps(&to->evtype, n);    swaps(&to->deviceid, n);    swapl(&to->time, n);    swapl(&to->root, n);    swapl(&to->event, n);    swapl(&to->child, n);    swapl(&to->root_x, n);    swapl(&to->root_y, n);    swapl(&to->event_x, n);    swapl(&to->event_y, n);    swaps(&to->sourceid, n);    swaps(&to->buttons_len, n);    swapl(&to->mods.base_mods, n);    swapl(&to->mods.latched_mods, n);    swapl(&to->mods.locked_mods, n);}
开发者ID:nikai3d,项目名称:xserver,代码行数:24,


示例28: ProcRRGetPanning

intProcRRGetPanning (ClientPtr client){    REQUEST(xRRGetPanningReq);    xRRGetPanningReply	rep;    RRCrtcPtr		crtc;    ScreenPtr		pScreen;    rrScrPrivPtr	pScrPriv;    BoxRec		total;    BoxRec		tracking;    INT16		border[4];    int			n;        REQUEST_SIZE_MATCH(xRRGetPanningReq);    VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);    /* All crtcs must be associated with screens before client     * requests are processed     */    pScreen = crtc->pScreen;    pScrPriv = rrGetScrPriv(pScreen);    if (!pScrPriv)	return RRErrorBase + BadRRCrtc;    memset(&rep, 0, sizeof(rep));    rep.type = X_Reply;    rep.status = RRSetConfigSuccess;    rep.sequenceNumber = client->sequence;    rep.length = 1;    rep.timestamp = pScrPriv->lastSetTime.milliseconds;    if (pScrPriv->rrGetPanning &&	pScrPriv->rrGetPanning (pScreen, crtc, &total, &tracking, border)) {	rep.left          = total.x1;	rep.top           = total.y1;	rep.width         = total.x2 - total.x1;	rep.height        = total.y2 - total.y1;	rep.track_left    = tracking.x1;	rep.track_top     = tracking.y1;	rep.track_width   = tracking.x2 - tracking.x1;	rep.track_height  = tracking.y2 - tracking.y1;	rep.border_left   = border[0];	rep.border_top    = border[1];	rep.border_right  = border[2];	rep.border_bottom = border[3];    }    if (client->swapped) {	swaps(&rep.sequenceNumber, n);	swapl(&rep.length, n);	swaps(&rep.timestamp, n);	swaps(&rep.left, n);	swaps(&rep.top, n);	swaps(&rep.width, n);	swaps(&rep.height, n);	swaps(&rep.track_left, n);	swaps(&rep.track_top, n);	swaps(&rep.track_width, n);	swaps(&rep.track_height, n);	swaps(&rep.border_left, n);	swaps(&rep.border_top, n);	swaps(&rep.border_right, n);	swaps(&rep.border_bottom, n);    }    WriteToClient(client, sizeof(xRRGetPanningReply), (char *)&rep);    return Success;}
开发者ID:kthxbyte,项目名称:xorg-wm8850,代码行数:68,


示例29: ProcRRSetCrtcConfig

//.........这里部分代码省略.........     * Validate requested rotation     */    rotation = (Rotation) stuff->rotation;    /* test the rotation bits only! */    switch (rotation & 0xf) {    case RR_Rotate_0:    case RR_Rotate_90:    case RR_Rotate_180:    case RR_Rotate_270:	break;    default:	/*	 * Invalid rotation	 */	client->errorValue = stuff->rotation;	free(outputs);	return BadValue;    }    if (mode)    {	if ((~crtc->rotations) & rotation)	{	    /*	     * requested rotation or reflection not supported by screen	     */	    client->errorValue = stuff->rotation;	    free(outputs);	    return BadMatch;	}    #ifdef RANDR_12_INTERFACE	/*	 * Check screen size bounds if the DDX provides a 1.2 interface	 * for setting screen size. Else, assume the CrtcSet sets	 * the size along with the mode. If the driver supports transforms,	 * then it must allow crtcs to display a subset of the screen, so	 * only do this check for drivers without transform support.	 */	if (pScrPriv->rrScreenSetSize && !crtc->transforms)	{	    int source_width;	    int	source_height;	    PictTransform transform;	    struct pixman_f_transform f_transform, f_inverse;	    RRTransformCompute (stuff->x, stuff->y,				mode->mode.width, mode->mode.height,				rotation,				&crtc->client_pending_transform,				&transform, &f_transform, &f_inverse);	    RRModeGetScanoutSize (mode, &transform, &source_width, &source_height);	    if (stuff->x + source_width > pScreen->width)	    {		client->errorValue = stuff->x;		free(outputs);		return BadValue;	    }	    	    if (stuff->y + source_height > pScreen->height)	    {		client->errorValue = stuff->y;		free(outputs);		return BadValue;	    }	}#endif    }        if (!RRCrtcSet (crtc, mode, stuff->x, stuff->y,		   rotation, numOutputs, outputs))    {	rep.status = RRSetConfigFailed;	goto sendReply;    }    rep.status = RRSetConfigSuccess;    pScrPriv->lastSetTime = time;    sendReply:    free(outputs);        rep.type = X_Reply;    /* rep.status has already been filled in */    rep.length = 0;    rep.sequenceNumber = client->sequence;    rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;    if (client->swapped)     {	int n;    	swaps(&rep.sequenceNumber, n);    	swapl(&rep.length, n);	swapl(&rep.newTimestamp, n);    }    WriteToClient(client, sizeof(xRRSetCrtcConfigReply), (char *)&rep);        return Success;}
开发者ID:kthxbyte,项目名称:xorg-wm8850,代码行数:101,


示例30: ProcRRGetCrtcInfo

intProcRRGetCrtcInfo (ClientPtr client){    REQUEST(xRRGetCrtcInfoReq);    xRRGetCrtcInfoReply	rep;    RRCrtcPtr			crtc;    CARD8			*extra;    unsigned long		extraLen;    ScreenPtr			pScreen;    rrScrPrivPtr		pScrPriv;    RRModePtr			mode;    RROutput			*outputs;    RROutput			*possible;    int				i, j, k, n;    int				width, height;    BoxRec			panned_area;        REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);    VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);    /* All crtcs must be associated with screens before client     * requests are processed     */    pScreen = crtc->pScreen;    pScrPriv = rrGetScrPriv(pScreen);    mode = crtc->mode;        rep.type = X_Reply;    rep.status = RRSetConfigSuccess;    rep.sequenceNumber = client->sequence;    rep.length = 0;    rep.timestamp = pScrPriv->lastSetTime.milliseconds;    if (pScrPriv->rrGetPanning &&	pScrPriv->rrGetPanning (pScreen, crtc, &panned_area, NULL, NULL) &&	(panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1))    { 	rep.x = panned_area.x1;	rep.y = panned_area.y1;	rep.width = panned_area.x2 - panned_area.x1;	rep.height = panned_area.y2 - panned_area.y1;    }    else    {	RRCrtcGetScanoutSize (crtc, &width, &height);	rep.x = crtc->x;	rep.y = crtc->y;	rep.width = width;	rep.height = height;    }    rep.mode = mode ? mode->mode.id : 0;    rep.rotation = crtc->rotation;    rep.rotations = crtc->rotations;    rep.nOutput = crtc->numOutputs;    k = 0;    for (i = 0; i < pScrPriv->numOutputs; i++)	for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)	    if (pScrPriv->outputs[i]->crtcs[j] == crtc)		k++;    rep.nPossibleOutput = k;        rep.length = rep.nOutput + rep.nPossibleOutput;    extraLen = rep.length << 2;    if (extraLen)    {	extra = malloc(extraLen);	if (!extra)	    return BadAlloc;    }    else	extra = NULL;    outputs = (RROutput *) extra;    possible = (RROutput *) (outputs + rep.nOutput);        for (i = 0; i < crtc->numOutputs; i++)    {	outputs[i] = crtc->outputs[i]->id;	if (client->swapped)	    swapl (&outputs[i], n);    }    k = 0;    for (i = 0; i < pScrPriv->numOutputs; i++)	for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)	    if (pScrPriv->outputs[i]->crtcs[j] == crtc)	    {		possible[k] = pScrPriv->outputs[i]->id;		if (client->swapped)		    swapl (&possible[k], n);		k++;	    }        if (client->swapped) {	swaps(&rep.sequenceNumber, n);	swapl(&rep.length, n);	swapl(&rep.timestamp, n);	swaps(&rep.x, n);	swaps(&rep.y, n);	swaps(&rep.width, n);//.........这里部分代码省略.........
开发者ID:kthxbyte,项目名称:xorg-wm8850,代码行数:101,



注:本文中的swapl函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ swaps函数代码示例
C++ swapcache_free函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。