本文整理汇总了C++中S函数的典型用法代码示例。如果您正苦于以下问题:C++ S函数的具体用法?C++ S怎么用?C++ S使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了S函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: krb5int_accessor
krb5_error_code KRB5_CALLCONV
krb5int_accessor(krb5int_access *internals, krb5_int32 version)
{
if (version == KRB5INT_ACCESS_VERSION) {
#if DESIGNATED_INITIALIZERS
#define S(FIELD, VAL) .FIELD = VAL
#if defined __GNUC__ && __STDC_VERSION__ < 199901L
__extension__
#endif
static const krb5int_access internals_temp = {
#else
#define S(FIELD, VAL) internals_temp.FIELD = VAL
krb5int_access internals_temp;
#endif
S (arcfour_gsscrypt, krb5int_arcfour_gsscrypt),
S (auth_con_get_subkey_enctype, krb5_auth_con_get_subkey_enctype),
S (clean_hostname, krb5int_clean_hostname),
S (mandatory_cksumtype, krb5int_c_mandatory_cksumtype),
#ifndef LEAN_CLIENT
#define SC(FIELD, VAL) S(FIELD, VAL)
#else /* disable */
#define SC(FIELD, VAL) S(FIELD, 0)
#endif
SC (ser_pack_int64, krb5_ser_pack_int64),
SC (ser_unpack_int64, krb5_ser_unpack_int64),
#undef SC
#ifdef ENABLE_LDAP
#define SC(FIELD, VAL) S(FIELD, VAL)
#else
#define SC(FIELD, VAL) S(FIELD, 0)
#endif
SC (asn1_ldap_encode_sequence_of_keys, krb5int_ldap_encode_sequence_of_keys),
SC (asn1_ldap_decode_sequence_of_keys, krb5int_ldap_decode_sequence_of_keys),
#undef SC
#ifndef DISABLE_PKINIT
#define SC(FIELD, VAL) S(FIELD, VAL)
#else /* disable */
#define SC(FIELD, VAL) S(FIELD, 0)
#endif
SC (encode_krb5_pa_pk_as_req, encode_krb5_pa_pk_as_req),
SC (encode_krb5_pa_pk_as_req_draft9, encode_krb5_pa_pk_as_req_draft9),
SC (encode_krb5_pa_pk_as_rep, encode_krb5_pa_pk_as_rep),
SC (encode_krb5_pa_pk_as_rep_draft9, encode_krb5_pa_pk_as_rep_draft9),
SC (encode_krb5_auth_pack, encode_krb5_auth_pack),
SC (encode_krb5_auth_pack_draft9, encode_krb5_auth_pack_draft9),
SC (encode_krb5_kdc_dh_key_info, encode_krb5_kdc_dh_key_info),
SC (encode_krb5_reply_key_pack, encode_krb5_reply_key_pack),
SC (encode_krb5_reply_key_pack_draft9, encode_krb5_reply_key_pack_draft9),
SC (encode_krb5_typed_data, encode_krb5_typed_data),
SC (encode_krb5_td_trusted_certifiers, encode_krb5_td_trusted_certifiers),
SC (encode_krb5_td_dh_parameters, encode_krb5_td_dh_parameters),
SC (decode_krb5_pa_pk_as_req, decode_krb5_pa_pk_as_req),
SC (decode_krb5_pa_pk_as_req_draft9, decode_krb5_pa_pk_as_req_draft9),
SC (decode_krb5_pa_pk_as_rep, decode_krb5_pa_pk_as_rep),
SC (decode_krb5_pa_pk_as_rep_draft9, decode_krb5_pa_pk_as_rep_draft9),
SC (decode_krb5_auth_pack, decode_krb5_auth_pack),
SC (decode_krb5_auth_pack_draft9, decode_krb5_auth_pack_draft9),
SC (decode_krb5_kdc_dh_key_info, decode_krb5_kdc_dh_key_info),
SC (decode_krb5_principal_name, decode_krb5_principal_name),
SC (decode_krb5_reply_key_pack, decode_krb5_reply_key_pack),
SC (decode_krb5_reply_key_pack_draft9, decode_krb5_reply_key_pack_draft9),
SC (decode_krb5_typed_data, decode_krb5_typed_data),
SC (decode_krb5_td_trusted_certifiers, decode_krb5_td_trusted_certifiers),
SC (decode_krb5_td_dh_parameters, decode_krb5_td_dh_parameters),
SC (decode_krb5_as_req, decode_krb5_as_req),
SC (encode_krb5_kdc_req_body, encode_krb5_kdc_req_body),
SC (free_kdc_req, krb5_free_kdc_req),
SC (set_prompt_types, krb5int_set_prompt_types),
SC (encode_krb5_authdata_elt, encode_krb5_authdata_elt),
#undef SC
S (encode_krb5_sam_response_2, encode_krb5_sam_response_2),
S (encode_krb5_enc_sam_response_enc_2, encode_krb5_enc_sam_response_enc_2),
#if DESIGNATED_INITIALIZERS
};
#else
0;
#endif
*internals = internals_temp;
return 0;
}
示例2: gaussSeidel
int gaussSeidel(MAT &A,VEC b,VEC &x,int maxIter,double tol)
{
int n = A.dim();
VEC S(n);
VEC G(n);
VEC tmp(n);
MAT L(n);
VEC cpr(n);
//iterative
int k=0;
double err1;
double err2;
double errinf;
double diff1,diff2,diffinf;
while(k<maxIter){
for(int i=0;i<n;i++){
S[i] = 0;
}
for(int i=0;i<n;i++){
G[i] = A[i][i];
tmp[i] = x[i];
for(int j=0;j<n;j++){
if(j!=i){
S[i] = S[i] + A[i][j]*x[j];
}
}
x[i] = (1/G[i])*(b[i]-S[i]);
//both x[i] and S[i] are computed in the same for loop, so some updated values are used in the current iteration
}
k++;
err1 = 0;
err2 = 0;
errinf = 0;
for(int i=0;i<n;i++){
err1 += fabs(x[i] - tmp[i]);
err2 += pow(x[i] - tmp[i], 2);
errinf = max(errinf,fabs(x[i]-tmp[i]));
}
err2 = pow(err2,0.5);
if(err1<tol){
break;
}
}
diff1 = 0;
diff2 = 0;
diffinf = 0;
//the answer from hw4
L = cholesky(A); //in-place Cholesky Decomposition
cpr = choSolve(L,b); //solve the linear system by forward and backward substitution
//use the same method to compute the error between hw4 and hw5, see if < 10^-7. if not, decrease the tol
for(int i=0;i<n;i++){
diff1 += fabs(x[i] - cpr[i]);
diff2 += pow(x[i] - cpr[i], 2);
diffinf = max(diffinf,fabs(x[i]-cpr[i]));
}
diff2 = pow(diff2,0.5);
printf("error between hw4 and hw5(1-norm 2-norm infinity-norm): %e %e %e\n",diff1,diff2,diffinf);
return k;
}
示例3: S
static void S::poo()
{
throw S();
}
示例4: I
I(power_cubes),
{0}
#undef _OFS
};
static const save_field_t clientfields[] = {
#define _OFS CLOFS
I(ps.pmove.pm_type),
SA(ps.pmove.origin, 3),
SA(ps.pmove.velocity, 3),
B(ps.pmove.pm_flags),
B(ps.pmove.pm_time),
S(ps.pmove.gravity),
SA(ps.pmove.delta_angles, 3),
V(ps.viewangles),
V(ps.viewoffset),
V(ps.kick_angles),
V(ps.gunangles),
V(ps.gunoffset),
I(ps.gunindex),
I(ps.gunframe),
FA(ps.blend, 4),
F(ps.fov),
示例5: display
void display(void)
{
printError("pre display");
static float time = 0;
// clear the screen
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Upload camera matrix
mat4 cameraMatrix = lookAt(cameraPos.x, cameraPos.y, cameraPos.z, targetPos.x, targetPos.y, targetPos.z, upVector.x, upVector.y, upVector.z);
// Skybox
glDisable(GL_DEPTH_TEST);
mat4 scale = S(100, 100, 100);
mat4 skybox_matrix = cameraMatrix;
skybox_matrix.m[3] = 0;
skybox_matrix.m[7] = 0;
skybox_matrix.m[11] = 0;
skybox_matrix.m[15] = 1;
// Upload time
glUniform1f(glGetUniformLocation(program, "gTime"), time);
// Default camera for all other renders except the skybox
glUniformMatrix4fv(glGetUniformLocation(program, "gView"), 1, GL_TRUE, skybox_matrix.m);
glUniformMatrix4fv(glGetUniformLocation(program, "gWorld"), 1, GL_TRUE, scale.m);
glUniform1i(glGetUniformLocation(program, "skybox_active"), 1);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, skybox_texture);
DrawModel(skybox, program, "InPosL", "InNormalL", "InTex");
glUniform1i(glGetUniformLocation(program, "skybox_active"), 0);
glEnable(GL_DEPTH_TEST);
// Default camera for all other renders except the skybox
glUniformMatrix4fv(glGetUniformLocation(program, "gView"), 1, GL_TRUE, cameraMatrix.m);
// Eye position
GLfloat eyePos[] = { cameraPos.x, cameraPos.y, cameraPos.z };
glUniform3fv(glGetUniformLocation(program, "gEyePosW"), 1, eyePos);
// Ground (multitextured)
scale = S(10, 10, 10);
glUniformMatrix4fv(glGetUniformLocation(program, "gWorld"), 1, GL_TRUE, scale.m);
glUniform1i(glGetUniformLocation(program, "multitexturing"), 1);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, grass_texture);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, conc_texture);
DrawModel(ground, program, "InPosL", "InNormalL", "InTex");
glUniform1i(glGetUniformLocation(program, "multitexturing"), 0);
// Castle
scale = S(1, 1, 1);
mat4 trans = T(0, 0, 50);
glBindTexture(GL_TEXTURE_2D, conc_texture);
glUniformMatrix4fv(glGetUniformLocation(program, "gWorld"), 1, GL_TRUE, Mult(trans, scale).m);
DrawModel(castle, program, "InPosL", "InNormalL", "InTex");
// Windmill
render_windmill(&windmill, program, time);
glutSwapBuffers();
time += 0.01;
}
示例6: test1
void test1()
{
test(S(""), S(""), S::npos);
test(S(""), S("laenf"), S::npos);
test(S(""), S("pqlnkmbdjo"), S::npos);
test(S(""), S("qkamfogpnljdcshbreti"), S::npos);
test(S("nhmko"), S(""), 4);
test(S("lahfb"), S("irkhs"), 4);
test(S("gmfhd"), S("kantesmpgj"), 4);
test(S("odaft"), S("oknlrstdpiqmjbaghcfe"), S::npos);
test(S("eolhfgpjqk"), S(""), 9);
test(S("nbatdlmekr"), S("bnrpe"), 8);
test(S("jdmciepkaq"), S("jtdaefblso"), 9);
test(S("hkbgspoflt"), S("oselktgbcapndfjihrmq"), S::npos);
test(S("gprdcokbnjhlsfmtieqa"), S(""), 19);
test(S("qjghlnftcaismkropdeb"), S("bjaht"), 18);
test(S("pnalfrdtkqcmojiesbhg"), S("hjlcmgpket"), 17);
test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), S::npos);
}
示例7: test0
void test0()
{
test(S(""), "", 0, 0);
test(S(""), "abcde", 0, S::npos);
test(S(""), "abcdeabcde", 0, S::npos);
test(S(""), "abcdeabcdeabcdeabcde", 0, S::npos);
test(S(""), "", 1, S::npos);
test(S(""), "abcde", 1, S::npos);
test(S(""), "abcdeabcde", 1, S::npos);
test(S(""), "abcdeabcdeabcdeabcde", 1, S::npos);
test(S("abcde"), "", 0, 0);
test(S("abcde"), "abcde", 0, 0);
test(S("abcde"), "abcdeabcde", 0, S::npos);
test(S("abcde"), "abcdeabcdeabcdeabcde", 0, S::npos);
test(S("abcde"), "", 1, 1);
test(S("abcde"), "abcde", 1, S::npos);
test(S("abcde"), "abcdeabcde", 1, S::npos);
test(S("abcde"), "abcdeabcdeabcdeabcde", 1, S::npos);
test(S("abcde"), "", 2, 2);
test(S("abcde"), "abcde", 2, S::npos);
test(S("abcde"), "abcdeabcde", 2, S::npos);
test(S("abcde"), "abcdeabcdeabcdeabcde", 2, S::npos);
test(S("abcde"), "", 4, 4);
test(S("abcde"), "abcde", 4, S::npos);
test(S("abcde"), "abcdeabcde", 4, S::npos);
test(S("abcde"), "abcdeabcdeabcdeabcde", 4, S::npos);
test(S("abcde"), "", 5, 5);
test(S("abcde"), "abcde", 5, S::npos);
test(S("abcde"), "abcdeabcde", 5, S::npos);
test(S("abcde"), "abcdeabcdeabcdeabcde", 5, S::npos);
test(S("abcde"), "", 6, S::npos);
test(S("abcde"), "abcde", 6, S::npos);
test(S("abcde"), "abcdeabcde", 6, S::npos);
test(S("abcde"), "abcdeabcdeabcdeabcde", 6, S::npos);
test(S("abcdeabcde"), "", 0, 0);
test(S("abcdeabcde"), "abcde", 0, 0);
test(S("abcdeabcde"), "abcdeabcde", 0, 0);
test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, S::npos);
test(S("abcdeabcde"), "", 1, 1);
test(S("abcdeabcde"), "abcde", 1, 5);
test(S("abcdeabcde"), "abcdeabcde", 1, S::npos);
test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, S::npos);
test(S("abcdeabcde"), "", 5, 5);
test(S("abcdeabcde"), "abcde", 5, 5);
test(S("abcdeabcde"), "abcdeabcde", 5, S::npos);
test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, S::npos);
test(S("abcdeabcde"), "", 9, 9);
test(S("abcdeabcde"), "abcde", 9, S::npos);
test(S("abcdeabcde"), "abcdeabcde", 9, S::npos);
test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, S::npos);
test(S("abcdeabcde"), "", 10, 10);
test(S("abcdeabcde"), "abcde", 10, S::npos);
test(S("abcdeabcde"), "abcdeabcde", 10, S::npos);
test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, S::npos);
test(S("abcdeabcde"), "", 11, S::npos);
test(S("abcdeabcde"), "abcde", 11, S::npos);
test(S("abcdeabcde"), "abcdeabcde", 11, S::npos);
test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, S::npos);
test(S("abcdeabcdeabcdeabcde"), "", 0, 0);
test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 0);
test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 0);
test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 0);
test(S("abcdeabcdeabcdeabcde"), "", 1, 1);
test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 5);
test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 5);
test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, S::npos);
test(S("abcdeabcdeabcdeabcde"), "", 10, 10);
test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 10);
test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 10);
test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, S::npos);
test(S("abcdeabcdeabcdeabcde"), "", 19, 19);
test(S("abcdeabcdeabcdeabcde"), "abcde", 19, S::npos);
test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, S::npos);
test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, S::npos);
test(S("abcdeabcdeabcdeabcde"), "", 20, 20);
test(S("abcdeabcdeabcdeabcde"), "abcde", 20, S::npos);
test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, S::npos);
test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, S::npos);
test(S("abcdeabcdeabcdeabcde"), "", 21, S::npos);
test(S("abcdeabcdeabcdeabcde"), "abcde", 21, S::npos);
test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, S::npos);
test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, S::npos);
}
示例8: Pseudoinverse
int Pseudoinverse(
size_t m, size_t n,
const doublecomplex *A, size_t lda,
doublecomplex *P, size_t ldp
){
integer info;
CMat Acopy(Eigen::Map<const CMat,Eigen::Unaligned,Eigen::OuterStride<> >(A, m, n, Eigen::OuterStride<>(lda)));
Eigen::Map<CMat,Eigen::Unaligned,Eigen::OuterStride<> > mP(P, n, m, Eigen::OuterStride<>(ldp));
if(m >= n){ // tall case
RVec S(n);
CMat VH(n,n);
doublecomplex dum;
integer lwork = -1;
RVec rwork(5*n);
zgesvd_(
"O","A", m,n, Acopy.data(), Acopy.outerStride(),
S.data(), NULL, m, VH.data(), VH.outerStride(),
&dum, lwork, rwork.data(), &info
);
lwork = (integer)dum.real();
CVec work(lwork);
zgesvd_(
"O","A", m,n, Acopy.data(), Acopy.outerStride(),
S.data(), NULL, m, VH.data(), VH.outerStride(),
work.data(), lwork, rwork.data(), &info
);
mP = Acopy.adjoint();
{
double threshold = 2 * std::numeric_limits<double>::epsilon() * S[0];
for(size_t i = 0; i < n; ++i){
if(S[i] < threshold){
break;
}
S[i] = 1./S[i];
}
}
mP = VH.adjoint() * S.asDiagonal() * mP;
}else{ // wide case
RVec S(m);
CMat U(m,m);
doublecomplex dum;
integer lwork = -1;
RVec rwork(5*m);
zgesvd_(
"A","O", m,n, Acopy.data(), Acopy.outerStride(),
S.data(), U.data(), U.outerStride(), NULL, m,
&dum, lwork, rwork.data(), &info
);
lwork = (integer)dum.real();
CVec work(lwork);
zgesvd_(
"A","O", m,n, Acopy.data(), Acopy.outerStride(),
S.data(), U.data(), U.outerStride(), NULL, m,
work.data(), lwork, rwork.data(), &info
);
mP = Acopy.adjoint();
{
double threshold = 2 * std::numeric_limits<double>::epsilon() * S[0];
for(size_t i = 0; i < m; ++i){
if(S[i] < threshold){
break;
}
S[i] = 1./S[i];
}
}
mP = mP * S.asDiagonal() * U.adjoint();
}
return info;
}
示例9: main
void main() {
int scrwid=320; int scrhei=200;
int jump=10;
float offrnd=pi/128;
float offvdamp=0.999;
float frernd=pi/10/scrwid;
float frevdamp=0.99;
float fredamp=0.9;
float amprnd=0.005;
float ampvdamp=0.99;
float ampdamp=0.99;
allegrosetup(scrwid,scrhei);
makepalette(&greypalette);
makepalette(&myRGB::hue);
List<S> xs=List<S>();
List<S> ys=List<S>();
List<S> xvs=List<S>();
List<S> yvs=List<S>();
randomise();
for (int i=0;i<12;i++) {
S s=S(myrnd()*scrwid,(1.0+myrnd()*4.0)*pi/(float)scrwid,myrnd()*1.0);
S v=S(0,0,0);
if (i%2) {
xs+s;
xvs+v;
} else {
ys+s;
yvs+v;
}
}
JBmp j=JBmp(scrwid,scrhei);
do {
for (int x=0;x<scrwid;x+=jump)
for (int y=0;y<scrhei;y+=jump) {
float sum=0;
for (int i=1;i<=xs.len;i++) {
S s=xs.num(i);
sum+=s.amp*sin(s.off+s.fre*x);
}
for (int i=1;i<=ys.len;i++) {
S s=ys.num(i);
sum+=s.amp*sin(s.off+s.fre*y);
}
sum=3.0*sum/(float)(xs.len+ys.len);
j.bmp[y][x]=ucharchop(128+128*sum);
if (x>0 && y>0)
for (int i=0;i<=jump;i++)
for (int k=0;k<=jump;k++)
j.bmp[y-jump+k][x-jump+i]=(1.0-i/(float)jump)*(1.0-k/(float)jump)*j.bmp[y-jump][x-jump]+(1.0-i/(float)jump)*(k/(float)jump)*j.bmp[y][x-jump]+(i/(float)jump)*(1.0-k/(float)jump)*j.bmp[y-jump][x]+(i/(float)jump)*(k/(float)jump)*j.bmp[y][x];
}
j.writetoscreen();
for (int i=1;i<=xs.len;i++) {
xvs.p2num(i)->off=xvs.p2num(i)->off*offvdamp+magrnd(offrnd);
xvs.p2num(i)->fre=xvs.p2num(i)->fre*frevdamp+magrnd(frernd);
xvs.p2num(i)->amp=xvs.p2num(i)->amp*ampvdamp+magrnd(amprnd);
xs.p2num(i)->add(xvs.num(i));
xs.p2num(i)->fre=xs.p2num(i)->fre*fredamp;
xs.p2num(i)->amp=xs.p2num(i)->amp*ampdamp;
}
for (int i=1;i<=ys.len;i++) {
yvs.p2num(i)->off=yvs.p2num(i)->off*offvdamp+magrnd(offrnd);
yvs.p2num(i)->fre=yvs.p2num(i)->fre*frevdamp+magrnd(frernd);
yvs.p2num(i)->amp=yvs.p2num(i)->amp*ampvdamp+magrnd(amprnd);
ys.p2num(i)->add(yvs.num(i));
ys.p2num(i)->fre=ys.p2num(i)->fre*fredamp;
ys.p2num(i)->amp=ys.p2num(i)->amp*ampdamp;
}
} while (!key[KEY_ESC]);
}
示例10: test1
void test1()
{
test(S(""), "", 0);
test(S(""), "abcde", S::npos);
test(S(""), "abcdeabcde", S::npos);
test(S(""), "abcdeabcdeabcdeabcde", S::npos);
test(S("abcde"), "", 0);
test(S("abcde"), "abcde", 0);
test(S("abcde"), "abcdeabcde", S::npos);
test(S("abcde"), "abcdeabcdeabcdeabcde", S::npos);
test(S("abcdeabcde"), "", 0);
test(S("abcdeabcde"), "abcde", 0);
test(S("abcdeabcde"), "abcdeabcde", 0);
test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", S::npos);
test(S("abcdeabcdeabcdeabcde"), "", 0);
test(S("abcdeabcdeabcdeabcde"), "abcde", 0);
test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0);
test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0);
}
示例11: K
[U_WORD_BREAK_ALETTER] = aletter, \
[U_WORD_BREAK_NUMERIC] = numeric, \
[U_WORD_BREAK_KATAKANA] = katakana, \
[U_WORD_BREAK_EXTENDNUMLET] = extendnumlet, \
[U_WORD_BREAK_REGIONAL_INDICATOR] = regional_indicator, \
[U_WORD_BREAK_MIDLETTER] = midletter, \
[U_WORD_BREAK_MIDNUMLET] = midnumlet, \
[U_WORD_BREAK_MIDNUM] = midnum }
#define K(s) (s | (1 << 4))
#define S(s) (s | (2 << 4))
#define D(s) (s | (3 << 4))
static const uint8_t wb_dfa[][U_WORD_BREAK_REGIONAL_INDICATOR + 1] = {
ROW(0,1, 2 ,2, 3 , 4 , 5 , 6 , 7 , 0 , 0 , 0 ,K(0),K(0)), // Other
ROW(0,1,K(2),2, 3 , 4 , 5 , 6 , 7 , 0 , 0 , 0 , 0 , 0 ), // CR
ROW(0,1, 2 ,2, 3 , 4 , 5 , 6 , 7 , 0 , 0 , 0 , 0 , 0 ), // LF | Newline
ROW(0,1, 2 ,2,K(3),K(4), 5 ,K(6), 7 ,S(8),S(8), 0 ,K(3),K(3)), // ALetter
ROW(0,1, 2 ,2,K(3),K(4), 5 ,K(6), 7 , 0 ,S(9),S(9),K(4),K(4)), // Numeric
ROW(0,1, 2 ,2, 3 , 4 ,K(5),K(6), 7 , 0 , 0 , 0 ,K(5),K(5)), // Katakana
ROW(0,1, 2 ,2,K(3),K(4),K(5),K(6), 7 , 0 , 0 , 0 ,K(6),K(6)), // ExtendNumLet
ROW(0,1, 2 ,2, 3 , 4 , 5 , 6 ,K(7), 0 , 0 , 0 ,K(7),K(7)), // Regional_Indicator
ROW(0,1, 2 ,2,D(3), 4 , 5 , 6 , 7 , 0 , 0 , 0 ,K(8),K(8)), // ALetter (MidLetter | MidNumLet)
ROW(0,1, 2 ,2, 3 ,D(4), 5 , 6 , 7 , 0 , 0 , 0 ,K(9),K(9)), // Numeric (MidNum | MidNumLet)
};
#undef D
#undef S
#undef K
void
u_words(const char *string, size_t n, u_substring_fn fn, void *closure)
{
const char *p = string;
示例12: kzalloc
static void *def_sitar_mbhc_cal(void)
{
void *sitar_cal;
struct sitar_mbhc_btn_detect_cfg *btn_cfg;
u16 *btn_low, *btn_high;
u8 *n_ready, *n_cic, *gain;
sitar_cal = kzalloc(SITAR_MBHC_CAL_SIZE(SITAR_MBHC_DEF_BUTTONS,
SITAR_MBHC_DEF_RLOADS),
GFP_KERNEL);
if (!sitar_cal) {
pr_err("%s: out of memory\n", __func__);
return NULL;
}
#define S(X, Y) ((SITAR_MBHC_CAL_GENERAL_PTR(sitar_cal)->X) = (Y))
S(t_ldoh, 100);
S(t_bg_fast_settle, 100);
S(t_shutdown_plug_rem, 255);
S(mbhc_nsa, 4);
S(mbhc_navg, 4);
#undef S
#define S(X, Y) ((SITAR_MBHC_CAL_PLUG_DET_PTR(sitar_cal)->X) = (Y))
S(mic_current, SITAR_PID_MIC_5_UA);
S(hph_current, SITAR_PID_MIC_5_UA);
S(t_mic_pid, 100);
S(t_ins_complete, 800);/*MM-SC-HS_Detect_Workaround-00, enlarge delay time from 250 to 800ms*/
S(t_ins_retry, 200);
#undef S
#define S(X, Y) ((SITAR_MBHC_CAL_PLUG_TYPE_PTR(sitar_cal)->X) = (Y))
S(v_no_mic, 30);
S(v_hs_max, 1650);
#undef S
#define S(X, Y) ((SITAR_MBHC_CAL_BTN_DET_PTR(sitar_cal)->X) = (Y))
S(c[0], 62);
S(c[1], 124);
S(nc, 1);
S(n_meas, 3);
S(mbhc_nsc, 11);
S(n_btn_meas, 1);
S(n_btn_con, 2);
S(num_btn, SITAR_MBHC_DEF_BUTTONS);
S(v_btn_press_delta_sta, 100);
S(v_btn_press_delta_cic, 50);
#undef S
btn_cfg = SITAR_MBHC_CAL_BTN_DET_PTR(sitar_cal);
btn_low = sitar_mbhc_cal_btn_det_mp(btn_cfg, SITAR_BTN_DET_V_BTN_LOW);
btn_high = sitar_mbhc_cal_btn_det_mp(btn_cfg, SITAR_BTN_DET_V_BTN_HIGH);
btn_low[0] = -50;
btn_high[0] = 100;/*SW-MM-RC-MBHC-02*/
btn_low[1] = 101;/*SW-MM-RC-MBHC-02*/
btn_high[1] = 250;/*SW-MM-RC-MBHC-01*/
btn_low[2] = 251;/*SW-MM-RC-MBHC-01*/
btn_high[2] = 400;/*SW-MM-RC-MBHC-01*/
btn_low[3] = 401;/*SW-MM-RC-MBHC-01*/
btn_high[3] = 700;/*SW-MM-RC-MBHC-01*/
/* MM-AY-NIKDS03283-00-[+ */
#if 0
btn_low[4] = 701;/*SW-MM-RC-MBHC-01*/
btn_high[4] = 800;/*SW-MM-RC-MBHC-01*/
btn_low[5] = 801;/*SW-MM-RC-MBHC-01*/
btn_high[5] = 900;/*SW-MM-RC-MBHC-01*/
btn_low[6] = 901;/*SW-MM-RC-MBHC-01*/
btn_high[6] = 1000;/*SW-MM-RC-MBHC-01*/
btn_low[7] = 1001;/*SW-MM-RC-MBHC-01*/
btn_high[7] = 1100;/*SW-MM-RC-MBHC-01*/
#endif
/* MM-AY-NIKDS03283-00-]- */
n_ready = sitar_mbhc_cal_btn_det_mp(btn_cfg, SITAR_BTN_DET_N_READY);
n_ready[0] = 48;
n_ready[1] = 38;
n_cic = sitar_mbhc_cal_btn_det_mp(btn_cfg, SITAR_BTN_DET_N_CIC);
n_cic[0] = 60;
n_cic[1] = 47;
gain = sitar_mbhc_cal_btn_det_mp(btn_cfg, SITAR_BTN_DET_GAIN);
gain[0] = 11;
gain[1] = 9;
return sitar_cal;
}
示例13: f
// CHECK: define void @_Z1fv(%struct.S* noalias sret %
S f() { return S(); }
示例14: S
namespace PSQT {
#define S(mg, eg) make_score(mg, eg)
// Bonus[PieceType][Square / 2] contains Piece-Square scores. For each piece
// type on a given square a (middlegame, endgame) score pair is assigned. Table
// is defined for files A..D and white side: it is symmetric for black side and
// second half of the files.
constexpr Score Bonus[][RANK_NB][int(FILE_NB) / 2] = {
{ },
{ // Pawn
{ S( 0, 0), S( 0, 0), S( 0, 0), S( 0, 0) },
{ S(-11,-3), S( 7, -1), S( 7, 7), S(17, 2) },
{ S(-16,-2), S( -3, 2), S( 23, 6), S(23,-1) },
{ S(-14, 7), S( -7, -4), S( 20,-8), S(24, 2) },
{ S( -5,13), S( -2, 10), S( -1,-1), S(12,-8) },
{ S(-11,16), S(-12, 6), S( -2, 1), S( 4,16) },
{ S( -2, 1), S( 20,-12), S(-10, 6), S(-2,25) }
},
{ // Knight
{ S(-161,-105), S(-96,-82), S(-80,-46), S(-73,-14) },
{ S( -83, -69), S(-43,-54), S(-21,-17), S(-10, 9) },
{ S( -71, -50), S(-22,-39), S( 0, -7), S( 9, 28) },
{ S( -25, -41), S( 18,-25), S( 43, 6), S( 47, 38) },
{ S( -26, -46), S( 16,-25), S( 38, 3), S( 50, 40) },
{ S( -11, -54), S( 37,-38), S( 56, -7), S( 65, 27) },
{ S( -63, -65), S(-19,-50), S( 5,-24), S( 14, 13) },
{ S(-195,-109), S(-67,-89), S(-42,-50), S(-29,-13) }
},
{ // Bishop
{ S(-49,-58), S(- 7,-31), S(-10,-37), S(-34,-19) },
{ S(-24,-34), S( 9, -9), S( 15,-14), S( 1, 4) },
{ S( -9,-23), S( 22, 0), S( -3, -3), S( 12, 16) },
{ S( 4,-26), S( 9, -3), S( 18, -5), S( 40, 16) },
{ S( -8,-26), S( 27, -4), S( 13, -7), S( 30, 14) },
{ S(-17,-24), S( 14, -2), S( -6, 0), S( 6, 13) },
{ S(-19,-34), S(-13,-10), S( 7,-12), S(-11, 6) },
{ S(-47,-55), S( -7,-32), S(-17,-36), S(-29,-17) }
},
{ // Rook
{ S(-25, 0), S(-16, 0), S(-16, 0), S(-9, 0) },
{ S(-21, 0), S( -8, 0), S( -3, 0), S( 0, 0) },
{ S(-21, 0), S( -9, 0), S( -4, 0), S( 2, 0) },
{ S(-22, 0), S( -6, 0), S( -1, 0), S( 2, 0) },
{ S(-22, 0), S( -7, 0), S( 0, 0), S( 1, 0) },
{ S(-21, 0), S( -7, 0), S( 0, 0), S( 2, 0) },
{ S(-12, 0), S( 4, 0), S( 8, 0), S(12, 0) },
{ S(-23, 0), S(-15, 0), S(-11, 0), S(-5, 0) }
},
{ // Queen
{ S( 0,-71), S(-4,-56), S(-3,-42), S(-1,-29) },
{ S(-4,-56), S( 6,-30), S( 9,-21), S( 8, -5) },
{ S(-2,-39), S( 6,-17), S( 9, -8), S( 9, 5) },
{ S(-1,-29), S( 8, -5), S(10, 9), S( 7, 19) },
{ S(-3,-27), S( 9, -5), S( 8, 10), S( 7, 21) },
{ S(-2,-40), S( 6,-16), S( 8,-10), S(10, 3) },
{ S(-2,-55), S( 7,-30), S( 7,-21), S( 6, -6) },
{ S(-1,-74), S(-4,-55), S(-1,-43), S( 0,-30) }
},
{ // King
{ S(272, 0), S(325, 41), S(273, 80), S(190, 93) },
{ S(277, 57), S(305, 98), S(241,138), S(183,131) },
{ S(198, 86), S(253,138), S(168,165), S(120,173) },
{ S(169,103), S(191,152), S(136,168), S(108,169) },
{ S(145, 98), S(176,166), S(112,197), S(69, 194) },
{ S(122, 87), S(159,164), S(85, 174), S(36, 189) },
{ S(87, 40), S(120, 99), S(64, 128), S(25, 141) },
{ S(64, 5), S(87, 60), S(49, 75), S(0, 75) }
}
};
#undef S
Score psq[PIECE_NB][SQUARE_NB];
// init() initializes piece-square tables: the white halves of the tables are
// copied from Bonus[] adding the piece value, then the black halves of the
// tables are initialized by flipping and changing the sign of the white scores.
void init() {
for (Piece pc = W_PAWN; pc <= W_KING; ++pc)
{
PieceValue[MG][~pc] = PieceValue[MG][pc];
PieceValue[EG][~pc] = PieceValue[EG][pc];
Score score = make_score(PieceValue[MG][pc], PieceValue[EG][pc]);
for (Square s = SQ_A1; s <= SQ_H8; ++s)
{
File f = std::min(file_of(s), ~file_of(s));
psq[ pc][ s] = score + Bonus[pc][rank_of(s)][f];
psq[~pc][~s] = -psq[pc][s];
}
}
}
} // namespace PSQT
示例15: def6
void def6( const S &v = S(100) )
{
if( v.a != 100 ) fail(__LINE__);
if( v.b != 101 ) fail(__LINE__);
if( v.c != 99 ) fail(__LINE__);
}